File tree Expand file tree Collapse file tree 6 files changed +34
-10
lines changed Expand file tree Collapse file tree 6 files changed +34
-10
lines changed Original file line number Diff line number Diff line change @@ -20,4 +20,9 @@ public function announcements()
20
20
{
21
21
return $ this ->hasMany ('App\Announcement ' )->orderBy ('created_at ' , 'desc ' );
22
22
}
23
+ public function evaluationNo (){
24
+ $ i =0 ;
25
+ foreach ($ this ->announcements as $ announcement ) if ($ announcement ->graded ==1 ) $ i +=1 ;
26
+ return $ i ;
27
+ }
23
28
}
Original file line number Diff line number Diff line change @@ -18,4 +18,20 @@ public function courses()
18
18
public function __toString () {
19
19
return $ this ->group_code ;
20
20
}
21
+ public function getAverageMarks (){
22
+ $ i =0 ;
23
+ $ j =0 ;
24
+ foreach ($ this ->users as $ user ){
25
+ $ i +=$ user ->averageMarks ();
26
+ $ j ++;
27
+ }
28
+ return $ i /$ j ;
29
+ }
30
+ public function getTotalEvaluations (){
31
+ $ i =0 ;
32
+ foreach ($ this ->courses as $ course ){
33
+ $ i +=$ course ->evaluationNo ();
34
+ }
35
+ return $ i ;
36
+ }
21
37
}
Original file line number Diff line number Diff line change @@ -96,8 +96,11 @@ public function averageMarks(){
96
96
}
97
97
}
98
98
}
99
- $ r = $ i *100 /$ j ;
100
- return $ r ;
99
+ if ($ j !=0 ){
100
+ $ r = $ i *100 /$ j ;
101
+ return $ r ;
102
+ }
103
+ else return 100 ;
101
104
}
102
105
public function getTotalClasses ()
103
106
{
Original file line number Diff line number Diff line change 425
425
</a >
426
426
</div >
427
427
<div class =" col" >
428
- <h5 >{{ $course -> name } } </h5 >
428
+ <h5 >< a href = " /courses/ {{ $course -> id } } " > {{ $course -> name } }</ a > </h5 >
429
429
</div >
430
430
</div >
431
431
</li >
442
442
<div class =" card-body" >
443
443
<div class =" row" >
444
444
<div class =" col" >
445
- <h5 class =" card-title text-uppercase text-muted mb-0 text-white" >Total traffic </h5 >
446
- <span class =" h2 font-weight-bold mb-0 text-white" >350,897 </span >
445
+ <h5 class =" card-title text-uppercase text-muted mb-0 text-white" >Total Evaluations </h5 >
446
+ <span class =" h2 font-weight-bold mb-0 text-white" >{{ $group -> getTotalEvaluations () } } </span >
447
447
</div >
448
448
<div class =" col-auto" >
449
449
<div class =" icon icon-shape bg-white text-dark rounded-circle shadow" >
452
452
</div >
453
453
</div >
454
454
<p class =" mt-3 mb-0 text-sm" >
455
- <span class =" text-white mr-2" ><i class =" fa fa-arrow-up" ></i > 3.48% </span >
456
- <span class =" text-nowrap text-light" >Since last month </span >
455
+ <span class =" text-white mr-2" ><i class =" fa fa-arrow-up" ></i ></span >
456
+ <span class =" text-nowrap text-light" >In All Courses </span >
457
457
</p >
458
458
</div >
459
459
</div >
465
465
<div class =" row" >
466
466
<div class =" col" >
467
467
<h5 class =" card-title text-uppercase text-muted mb-0 text-white" >Performance</h5 >
468
- <span class =" h2 font-weight-bold mb-0 text-white" >49,65% </span >
468
+ <span class =" h2 font-weight-bold mb-0 text-white" >{{ $group -> getAverageMarks () } } </span >
469
469
</div >
470
470
<div class =" col-auto" >
471
471
<div class =" icon icon-shape bg-white text-dark rounded-circle shadow" >
474
474
</div >
475
475
</div >
476
476
<p class =" mt-3 mb-0 text-sm" >
477
- <span class =" text-white mr-2" ><i class =" fa fa-arrow-up" ></i > 3.48% </span >
478
- <span class =" text-nowrap text-light" >Since last month </span >
477
+ <span class =" text-white mr-2" ><i class =" fa fa-arrow-up" ></i ></span >
478
+ <span class =" text-nowrap text-light" >Class Average Marks </span >
479
479
</p >
480
480
</div >
481
481
</div >
You can’t perform that action at this time.
0 commit comments