|
@@ -39,13 +39,21 @@ class Program extends Eloquent
|
39
|
39
|
|
40
|
40
|
public function publishedActivities()
|
41
|
41
|
{
|
42
|
|
- return $this->hasManyThrough('Activity', 'Course')->whereNotNull('activities.outcomes_attempted')->where('activities.draft', 0)->whereIn('semester_id', Session::get('semesters_ids'));
|
|
42
|
+
|
|
43
|
+ return $this->hasManyThrough('Activity', 'Course')
|
|
44
|
+ //->whereNotNull('activities.outcomes_attempted')
|
|
45
|
+ ->where('activities.draft', 0)->whereIn('semester_id', Session::get('semesters_ids'));
|
43
|
46
|
}
|
44
|
47
|
|
45
|
48
|
public function assessesOutcome($outcome_id)
|
46
|
49
|
{
|
47
|
50
|
|
48
|
51
|
foreach ($this->publishedActivities as $activity) {
|
|
52
|
+ $assessed = DB::table('activity_criterion')
|
|
53
|
+ ->join('assessments', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
|
|
54
|
+ ->where('activity_id', $activity->id)
|
|
55
|
+ ->first();
|
|
56
|
+ if (!$assessed) continue;
|
49
|
57
|
$outcomes_attempted = (array)$activity->o_att_array;
|
50
|
58
|
if (array_key_exists($outcome_id, $outcomes_attempted) && $outcomes_attempted[$outcome_id] != 0) {
|
51
|
59
|
return true;
|
|
@@ -158,52 +166,50 @@ class Program extends Eloquent
|
158
|
166
|
foreach ($semesters as $semester) {
|
159
|
167
|
$semesters_array[] = $semester->id;
|
160
|
168
|
}
|
161
|
|
-
|
162
|
|
-// DB::enableQueryLog();
|
163
|
|
-// dd(DB::getQueryLog());
|
164
|
|
-// $criteria=DB::table('new_criteria')
|
165
|
|
-// ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
|
166
|
|
-// ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
|
167
|
|
-// ->join('courses', 'activities.course_id', '=', 'courses.id')
|
168
|
|
-// ->join('programs', 'programs.id', '=', 'courses.program_id')
|
169
|
|
-// ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
|
170
|
|
-// ->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
|
171
|
|
-// ->where('programs.id','=',$this->id)
|
172
|
|
-// ->whereIn('courses.semester_id',$semesters_array)
|
173
|
|
-// ->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
|
174
|
|
-// ->distinct()
|
175
|
|
-// ->get()
|
176
|
|
-// ;
|
177
|
|
-
|
178
|
|
- $criteria=DB::table('criteria')
|
179
|
|
- ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
|
180
|
|
- ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
|
181
|
|
- ->join('courses', 'activities.course_id', '=', 'courses.id')
|
182
|
|
- ->join('programs', 'programs.id', '=', 'courses.program_id')
|
183
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
|
|
169
|
+
|
|
170
|
+ // DB::enableQueryLog();
|
|
171
|
+ // dd(DB::getQueryLog());
|
|
172
|
+ // $criteria=DB::table('new_criteria')
|
|
173
|
+ // ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
|
|
174
|
+ // ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
|
|
175
|
+ // ->join('courses', 'activities.course_id', '=', 'courses.id')
|
|
176
|
+ // ->join('programs', 'programs.id', '=', 'courses.program_id')
|
|
177
|
+ // ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
|
|
178
|
+ // ->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
|
|
179
|
+ // ->where('programs.id','=',$this->id)
|
|
180
|
+ // ->whereIn('courses.semester_id',$semesters_array)
|
|
181
|
+ // ->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
|
|
182
|
+ // ->distinct()
|
|
183
|
+ // ->get()
|
|
184
|
+ // ;
|
|
185
|
+
|
|
186
|
+ $criteria = DB::table('criteria')
|
|
187
|
+ ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
|
|
188
|
+ ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
|
|
189
|
+ ->join('courses', 'activities.course_id', '=', 'courses.id')
|
|
190
|
+ ->join('programs', 'programs.id', '=', 'courses.program_id')
|
|
191
|
+ ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
|
184
|
192
|
->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
|
185
|
193
|
->join('rubrics', 'rubric_activity.rubric_id', '=', 'rubrics.id')
|
186
|
|
- ->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
|
187
|
|
- ->where('programs.id','=',$this->id)
|
188
|
|
- ->whereIn('courses.semester_id',$semesters_array)
|
189
|
|
- ->select('criteria.id','expected_percentage','activity_criterion.activity_id')
|
190
|
|
- ->distinct()
|
191
|
|
- ->get()
|
192
|
|
- ;
|
193
|
|
-
|
194
|
|
-// dd(DB::getQueryLog());
|
195
|
|
-
|
196
|
|
- $conteo=0;
|
197
|
|
- $attempted_criteria_per_program_array=[];
|
198
|
|
-// $students_attempted=0;
|
199
|
|
-// $students_achieved=0;
|
200
|
|
- foreach($criteria as $criterion)
|
201
|
|
- {
|
202
|
|
- if(!isset($students_attempted[$criterion->id]))$students_attempted[$criterion->id]=0;
|
203
|
|
- if(!isset($students_achieved[$criterion->id]))$students_achieved[$criterion->id]=0;
|
204
|
|
- $attempted_criteria_per_program_array[$criterion->id]=1;
|
205
|
|
- $students_attempted[$criterion->id]+=Criterion::students_attempted($criterion->id, $criterion->activity_id);
|
206
|
|
- $students_achieved[$criterion->id]+=Criterion::students_achieved($criterion->id, $criterion->activity_id);
|
|
194
|
+ ->where('criterion_objective_outcome.outcome_id', '=', $outcome_id)
|
|
195
|
+ ->where('programs.id', '=', $this->id)
|
|
196
|
+ ->whereIn('courses.semester_id', $semesters_array)
|
|
197
|
+ ->select('criteria.id', 'expected_percentage', 'activity_criterion.activity_id')
|
|
198
|
+ ->distinct()
|
|
199
|
+ ->get();
|
|
200
|
+
|
|
201
|
+ // dd(DB::getQueryLog());
|
|
202
|
+
|
|
203
|
+ $conteo = 0;
|
|
204
|
+ $attempted_criteria_per_program_array = [];
|
|
205
|
+ // $students_attempted=0;
|
|
206
|
+ // $students_achieved=0;
|
|
207
|
+ foreach ($criteria as $criterion) {
|
|
208
|
+ if (!isset($students_attempted[$criterion->id])) $students_attempted[$criterion->id] = 0;
|
|
209
|
+ if (!isset($students_achieved[$criterion->id])) $students_achieved[$criterion->id] = 0;
|
|
210
|
+ $attempted_criteria_per_program_array[$criterion->id] = 1;
|
|
211
|
+ $students_attempted[$criterion->id] += Criterion::students_attempted($criterion->id, $criterion->activity_id);
|
|
212
|
+ $students_achieved[$criterion->id] += Criterion::students_achieved($criterion->id, $criterion->activity_id);
|
207
|
213
|
}
|
208
|
214
|
// var_dump($outcome_id);
|
209
|
215
|
// var_dump($this->id);
|
|
@@ -218,13 +224,10 @@ class Program extends Eloquent
|
218
|
224
|
foreach ($students_attempted as $criteria_id => $students_attempted_n) {
|
219
|
225
|
if ($students_attempted_n) {
|
220
|
226
|
$percentage_students_who_achieved = 100.0 * $students_achieved[$criteria_id] / $students_attempted[$criteria_id];
|
221
|
|
- }
|
222
|
|
- else
|
223
|
|
- {
|
224
|
|
- $percentage_students_who_achieved=0;
|
|
227
|
+ } else {
|
|
228
|
+ $percentage_students_who_achieved = 0;
|
225
|
229
|
}
|
226
|
|
- if($percentage_students_who_achieved>=$criterion->expected_percentage)
|
227
|
|
- {
|
|
230
|
+ if ($percentage_students_who_achieved >= $criterion->expected_percentage) {
|
228
|
231
|
$conteo++;
|
229
|
232
|
}
|
230
|
233
|
}
|
|
@@ -247,52 +250,50 @@ class Program extends Eloquent
|
247
|
250
|
foreach ($semesters as $semester) {
|
248
|
251
|
$semesters_array[] = $semester->id;
|
249
|
252
|
}
|
250
|
|
-
|
251
|
|
-// DB::enableQueryLog();
|
252
|
|
-// dd(DB::getQueryLog());
|
253
|
|
-// $criteria=DB::table('new_criteria')
|
254
|
|
-// ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
|
255
|
|
-// ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
|
256
|
|
-// ->join('courses', 'activities.course_id', '=', 'courses.id')
|
257
|
|
-// ->join('programs', 'programs.id', '=', 'courses.program_id')
|
258
|
|
-// ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
|
259
|
|
-// ->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
|
260
|
|
-// ->where('programs.id','=',$this->id)
|
261
|
|
-// ->whereIn('courses.semester_id',$semesters_array)
|
262
|
|
-// ->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
|
263
|
|
-// ->distinct()
|
264
|
|
-// ->get()
|
265
|
|
-// ;
|
266
|
|
-
|
267
|
|
- $criteria=DB::table('criteria')
|
268
|
|
- ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
|
269
|
|
- ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
|
270
|
|
- ->join('courses', 'activities.course_id', '=', 'courses.id')
|
271
|
|
- ->join('programs', 'programs.id', '=', 'courses.program_id')
|
272
|
|
- ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
|
|
253
|
+
|
|
254
|
+ // DB::enableQueryLog();
|
|
255
|
+ // dd(DB::getQueryLog());
|
|
256
|
+ // $criteria=DB::table('new_criteria')
|
|
257
|
+ // ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
|
|
258
|
+ // ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
|
|
259
|
+ // ->join('courses', 'activities.course_id', '=', 'courses.id')
|
|
260
|
+ // ->join('programs', 'programs.id', '=', 'courses.program_id')
|
|
261
|
+ // ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
|
|
262
|
+ // ->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
|
|
263
|
+ // ->where('programs.id','=',$this->id)
|
|
264
|
+ // ->whereIn('courses.semester_id',$semesters_array)
|
|
265
|
+ // ->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
|
|
266
|
+ // ->distinct()
|
|
267
|
+ // ->get()
|
|
268
|
+ // ;
|
|
269
|
+
|
|
270
|
+ $criteria = DB::table('criteria')
|
|
271
|
+ ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
|
|
272
|
+ ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
|
|
273
|
+ ->join('courses', 'activities.course_id', '=', 'courses.id')
|
|
274
|
+ ->join('programs', 'programs.id', '=', 'courses.program_id')
|
|
275
|
+ ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
|
273
|
276
|
->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
|
274
|
277
|
->join('rubrics', 'rubric_activity.rubric_id', '=', 'rubrics.id')
|
275
|
|
- ->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
|
276
|
|
- ->where('programs.id','=',$this->id)
|
277
|
|
- ->whereIn('courses.semester_id',$semesters_array)
|
278
|
|
- ->select('criteria.id','expected_percentage','activity_criterion.activity_id')
|
279
|
|
- ->distinct()
|
280
|
|
- ->get()
|
281
|
|
- ;
|
282
|
|
-
|
283
|
|
-// dd(DB::getQueryLog());
|
284
|
|
-
|
285
|
|
- $conteo=0;
|
286
|
|
- $attempted_criteria_per_program_array=[];
|
287
|
|
-// $students_attempted=0;
|
288
|
|
-// $students_achieved=0;
|
289
|
|
- foreach($criteria as $criterion)
|
290
|
|
- {
|
291
|
|
- if(!isset($students_attempted[$criterion->id]))$students_attempted[$criterion->id]=0;
|
292
|
|
- if(!isset($students_achieved[$criterion->id]))$students_achieved[$criterion->id]=0;
|
293
|
|
- $attempted_criteria_per_program_array[$criterion->id]=1;
|
294
|
|
- $students_attempted[$criterion->id]+=Criterion::students_attempted($criterion->id, $criterion->activity_id);
|
295
|
|
- $students_achieved[$criterion->id]+=Criterion::students_achieved($criterion->id, $criterion->activity_id);
|
|
278
|
+ ->where('criterion_objective_outcome.outcome_id', '=', $outcome_id)
|
|
279
|
+ ->where('programs.id', '=', $this->id)
|
|
280
|
+ ->whereIn('courses.semester_id', $semesters_array)
|
|
281
|
+ ->select('criteria.id', 'expected_percentage', 'activity_criterion.activity_id')
|
|
282
|
+ ->distinct()
|
|
283
|
+ ->get();
|
|
284
|
+
|
|
285
|
+ // dd(DB::getQueryLog());
|
|
286
|
+
|
|
287
|
+ $conteo = 0;
|
|
288
|
+ $attempted_criteria_per_program_array = [];
|
|
289
|
+ // $students_attempted=0;
|
|
290
|
+ // $students_achieved=0;
|
|
291
|
+ foreach ($criteria as $criterion) {
|
|
292
|
+ if (!isset($students_attempted[$criterion->id])) $students_attempted[$criterion->id] = 0;
|
|
293
|
+ if (!isset($students_achieved[$criterion->id])) $students_achieved[$criterion->id] = 0;
|
|
294
|
+ $attempted_criteria_per_program_array[$criterion->id] = 1;
|
|
295
|
+ $students_attempted[$criterion->id] += Criterion::students_attempted($criterion->id, $criterion->activity_id);
|
|
296
|
+ $students_achieved[$criterion->id] += Criterion::students_achieved($criterion->id, $criterion->activity_id);
|
296
|
297
|
}
|
297
|
298
|
// var_dump($this->id);
|
298
|
299
|
// if(isset($students_attempted))var_dump($students_attempted);
|
|
@@ -306,13 +307,10 @@ class Program extends Eloquent
|
306
|
307
|
foreach ($students_attempted as $criteria_id => $students_attempted_n) {
|
307
|
308
|
if ($students_attempted_n) {
|
308
|
309
|
$percentage_students_who_achieved = 100.0 * $students_achieved[$criteria_id] / $students_attempted[$criteria_id];
|
309
|
|
- }
|
310
|
|
- else
|
311
|
|
- {
|
312
|
|
- $percentage_students_who_achieved=0;
|
|
310
|
+ } else {
|
|
311
|
+ $percentage_students_who_achieved = 0;
|
313
|
312
|
}
|
314
|
|
- if($percentage_students_who_achieved>=$criterion->expected_percentage)
|
315
|
|
- {
|
|
313
|
+ if ($percentage_students_who_achieved >= $criterion->expected_percentage) {
|
316
|
314
|
$conteo++;
|
317
|
315
|
}
|
318
|
316
|
}
|