|
@@ -28,10 +28,11 @@ class Activity extends Eloquent
|
28
|
28
|
return DB::table('students')
|
29
|
29
|
-> join('assessments','assessments.student_id','=','students.id')
|
30
|
30
|
-> join('activity_criterion','assessments.activity_criterion_id','=','activity_criterion.id')
|
31
|
|
- ->where('activity_criterion.activity_id', '=', $this->id)
|
32
|
|
- ->select('students.*')
|
33
|
|
- ->distinct()
|
34
|
|
- ->get();;
|
|
31
|
+ ->whereNotNull('score')
|
|
32
|
+ ->where('activity_criterion.activity_id', '=', $this->id)
|
|
33
|
+ ->select('students.*')
|
|
34
|
+ ->distinct()
|
|
35
|
+ ->get();;
|
35
|
36
|
}
|
36
|
37
|
|
37
|
38
|
public function student_scores($student_id)
|
|
@@ -51,8 +52,9 @@ class Activity extends Eloquent
|
51
|
52
|
// ->orderBy('criterion_id')
|
52
|
53
|
// ->get();
|
53
|
54
|
$activity_id=$this->id;
|
54
|
|
- $assessments=DB::select(DB::raw("select id, COALESCE(score,0) score from
|
55
|
|
- (select activity_criterion_id, score from`assessments` where student_id= $student_id) a right OUTER join
|
|
55
|
+// $assessments=DB::select(DB::raw("select id, COALESCE(score,0) score from
|
|
56
|
+ $assessments=DB::select(DB::raw("select id, score from
|
|
57
|
+ (select activity_criterion_id, score from`assessments` where score is not null and student_id= $student_id) a right OUTER join
|
56
|
58
|
(select id from `activity_criterion` where `activity_criterion`.`activity_id` = $activity_id) b on a.activity_criterion_id = b.id"));
|
57
|
59
|
|
58
|
60
|
|
|
@@ -85,8 +87,9 @@ class Activity extends Eloquent
|
85
|
87
|
// ->get();
|
86
|
88
|
//rubrics->expected_points
|
87
|
89
|
$activity_id=$this->id;
|
88
|
|
- $percentage=DB::select(DB::raw("select COALESCE(ROUND(100*sum(score*weight)/sum(max_score*weight),2),0) percentage from (select activity_criterion_id, score from`assessments` where
|
89
|
|
- student_id= $student_id) a right OUTER join
|
|
90
|
+// $percentage=DB::select(DB::raw("select COALESCE(ROUND(100*sum(score*weight)/sum(max_score*weight),2),0) percentage from (select activity_criterion_id, score from`assessments` where
|
|
91
|
+ $percentage=DB::select(DB::raw("select (ROUND(100*sum(score*weight)/sum(max_score*weight),2)) percentage from (select activity_criterion_id, score from`assessments` where
|
|
92
|
+ score is not null and student_id= $student_id) a right OUTER join
|
90
|
93
|
(select id, weight, activity_id from `activity_criterion` where `activity_criterion`.`activity_id` = $activity_id) b on a.activity_criterion_id = b.id join
|
91
|
94
|
rubric_activity on rubric_activity.activity_id=b.activity_id join rubrics on rubrics.id=rubric_activity.rubric_id"));
|
92
|
95
|
|
|
@@ -97,7 +100,7 @@ class Activity extends Eloquent
|
97
|
100
|
{
|
98
|
101
|
|
99
|
102
|
$activity_criterion = DB::table('activity_criterion')->where('activity_id', '=', $this->id)->lists('id');
|
100
|
|
- $amount_of_students = DB::table('assessments')->whereIn('activity_criterion_id', $activity_criterion)->lists('student_id');
|
|
103
|
+ $amount_of_students = DB::table('assessments')->whereNotNull('score')->whereIn('activity_criterion_id', $activity_criterion)->lists('student_id');
|
101
|
104
|
|
102
|
105
|
return count($amount_of_students);
|
103
|
106
|
}
|
|
@@ -114,10 +117,12 @@ class Activity extends Eloquent
|
114
|
117
|
|
115
|
118
|
|
116
|
119
|
$assessments_passed = count(DB::table('assessments')
|
|
120
|
+ ->whereNotNull('score')
|
117
|
121
|
->where('score', '>=', $this->rubric[0]->expected_points)
|
118
|
122
|
->where('activity_criterion_id', '=', $single_ac->id)
|
119
|
123
|
->lists('student_id'));
|
120
|
124
|
$assessments_attempted = count(DB::table('assessments')
|
|
125
|
+ ->whereNotNull('score')
|
121
|
126
|
->where('activity_criterion_id', '=', $single_ac->id)
|
122
|
127
|
->lists('student_id'));
|
123
|
128
|
|
|
@@ -150,6 +155,7 @@ class Activity extends Eloquent
|
150
|
155
|
->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
|
151
|
156
|
->join('assessments', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
|
152
|
157
|
->where('activity_criterion.activity_id', '=', $this->id)
|
|
158
|
+ ->whereNotNull('score')
|
153
|
159
|
->select(
|
154
|
160
|
array(
|
155
|
161
|
'activity_criterion.id as id',
|
|
@@ -167,16 +173,19 @@ class Activity extends Eloquent
|
167
|
173
|
->where('criterion_id', '=', $single_crit->criterion_id)
|
168
|
174
|
->lists('outcome_id'));
|
169
|
175
|
$amount_of_students = count(DB::table('assessments')
|
170
|
|
- ->where("activity_criterion_id", '=', $single_crit->id)
|
|
176
|
+ ->whereNotNull('score')
|
|
177
|
+ ->where("activity_criterion_id", '=', $single_crit->id)
|
171
|
178
|
->lists('student_id'));
|
172
|
179
|
|
173
|
180
|
|
174
|
181
|
$student_pass = DB::table('assessments')
|
175
|
182
|
->where("activity_criterion_id", '=', $single_crit->id)
|
176
|
183
|
->where('score', '>=', $this->rubric[0]->expected_points)
|
|
184
|
+ ->whereNotNull('score')
|
177
|
185
|
->lists('student_id');
|
178
|
186
|
$amount_of_students_passed = count(DB::table('assessments')
|
179
|
187
|
->where("activity_criterion_id", '=', $single_crit->id)
|
|
188
|
+ ->whereNotNull('score')
|
180
|
189
|
->where('score', '>=', $this->rubric[0]->expected_points)
|
181
|
190
|
->lists('student_id'));
|
182
|
191
|
|
|
@@ -319,6 +328,7 @@ class Activity extends Eloquent
|
319
|
328
|
$students_attempted = DB::table('assessments as a')
|
320
|
329
|
->whereIn('a.activity_criterion_id', $ac_criteria)
|
321
|
330
|
->groupBy('a.student_id')
|
|
331
|
+ ->whereNotNull('score')
|
322
|
332
|
->select(
|
323
|
333
|
'a.student_id',
|
324
|
334
|
DB::raw('count(`a`.`activity_criterion_id`) attempted'),
|
|
@@ -448,6 +458,7 @@ class Activity extends Eloquent
|
448
|
458
|
->lists('id');
|
449
|
459
|
|
450
|
460
|
$assessments = DB::table('assessments')
|
|
461
|
+ ->whereNotNull('score')
|
451
|
462
|
->whereIn('activity_criterion_id', $all_criterion)
|
452
|
463
|
->lists('id');
|
453
|
464
|
|
|
@@ -460,6 +471,7 @@ class Activity extends Eloquent
|
460
|
471
|
return DB::table('activities')
|
461
|
472
|
->join('activity_criterion as ac', 'ac.activity_id', '=', 'activities.id')
|
462
|
473
|
->join('assessments', 'assessments.activity_criterion_id', '=', 'ac.id')
|
|
474
|
+ ->whereNotNull('score')
|
463
|
475
|
->where('activity_id', $this->id)
|
464
|
476
|
->where('student_id', $student_id)
|
465
|
477
|
->count();
|
|
@@ -488,7 +500,8 @@ class Activity extends Eloquent
|
488
|
500
|
|
489
|
501
|
$all_criterion = DB::table('activity_criterion')
|
490
|
502
|
->join('assessments', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
|
491
|
|
- ->where('activity_criterion.activity_id', '=', $this->id)
|
|
503
|
+ ->whereNotNull('score')
|
|
504
|
+ ->where('activity_criterion.activity_id', '=', $this->id)
|
492
|
505
|
->groupBy('criterion_id')
|
493
|
506
|
|
494
|
507
|
->lists('criterion_id');
|