Browse Source

rubricas y objetivos, queries de school, dominios admin

parent
commit
1690a19331

+ 3
- 2
app/controllers/SchoolCoordinatorsController.php View File

@@ -62,6 +62,7 @@ class SchoolCoordinatorsController extends \BaseController
62 62
             ->get();
63 63
 
64 64
 
65
+
65 66
         $grad_grouped_courses = Course::
66 67
             //             select(DB::raw('courses.name, courses.code, courses.number, max(courses.outcomes_attempted) as outcomes_attempted, courses.semester_id, courses.program_id'))
67 68
             select(DB::raw('courses.name, courses.code, courses.number, courses.semester_id, courses.program_id'))
@@ -216,7 +217,7 @@ class SchoolCoordinatorsController extends \BaseController
216 217
             return View::make('local.managers.shared.schoolTest', compact('title', 'outcomes_grad', 'outcomes_undergrad', 'undergrad_programs', 'grad_programs', 'undergrad_outcomes_attempted', 'grad_outcomes_attempted', 'undergrad_outcomes_achieved', 'grad_outcomes_achieved', 'schools', 'school', 'undergrad_assessed_sections_count', 'grad_assessed_sections_count', 'undergrad_school_sections_count', 'grad_school_sections_count', 'achievedUndergradProgramsPerOutcome', 'achievedGradProgramsPerOutcome', 'attemptedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'grad_grouped_courses', 'undergrad_grouped_courses', 'participating_programs'));
217 218
         }
218 219
     }
219
-     public function overview()
220
+    public function overview()
220 221
     {
221 222
         ini_set('memory_limit', '256M');
222 223
         DB::connection()->disableQueryLog();
@@ -760,4 +761,4 @@ class SchoolCoordinatorsController extends \BaseController
760 761
         //         return View::make('local.managers.shared.school', compact('title', 'outcomes', 'undergrad_programs', 'grad_programs', 'undergrad_outcomes_attempted', 'grad_outcomes_attempted', 'undergrad_outcomes_achieved', 'grad_outcomes_achieved', 'schools', 'school', 'undergrad_assessed_sections_count', 'grad_assessed_sections_count', 'undergrad_school_sections_count', 'grad_school_sections_count', 'achievedUndergradProgramsPerOutcome', 'achievedGradProgramsPerOutcome', 'attemptedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'grad_grouped_courses', 'undergrad_grouped_courses', 'participating_programs', 'participating_undergrad_programs', 'participating_grad_programs'));
761 762
         return View::make('local.managers.shared.school', compact('title', 'outcomes', 'undergrad_programs', 'grad_programs', 'undergrad_outcomes_attempted', 'grad_outcomes_attempted', 'undergrad_outcomes_achieved', 'grad_outcomes_achieved', 'schools', 'school', 'undergrad_assessed_sections_count', 'grad_assessed_sections_count', 'undergrad_school_sections_count', 'grad_school_sections_count', 'achievedUndergradProgramsPerOutcome', 'achievedGradProgramsPerOutcome', 'attemptedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'grad_grouped_courses', 'undergrad_grouped_courses', 'participating_programs'));
762 763
     }
763
-}
764
+}

+ 458
- 239
app/controllers/SchoolsController.php View File

@@ -38,6 +38,30 @@ class SchoolsController extends \BaseController
38 38
         $outcomes_grad = Outcome::active_by_semesters($semesters, 1);
39 39
         $outcomes_undergrad = Outcome::active_by_semesters($semesters, 0);
40 40
 
41
+        $undergrad_stu_outcome_attempted = [];
42
+        $grad_stu_outcome_attempted = [];
43
+        $undergrad_stu_outcome_achieved = [];
44
+        $grad_stu_outcome_achieved = [];
45
+
46
+        $attemptedUndergradProgramsPerOutcome = [];
47
+        $achievedUndergradProgramsPerOutcome = [];
48
+        $attemptedGradProgramsPerOutcome = [];
49
+        $achievedGradProgramsPerOutcome = [];
50
+
51
+        foreach ($outcomes_undergrad as $outcome) {
52
+            $undergrad_stu_outcome_attempted[$outcome->id] = 0;
53
+            $undergrad_stu_outcome_achieved[$outcome->id] = 0;
54
+            $attemptedUndergradProgramsPerOutcome[$outcome->id] = [];
55
+            $achievedUndergradProgramsPerOutcome[$outcome->id] = [];
56
+        }
57
+
58
+        foreach ($outcomes_grad as $outcome) {
59
+            $grad_stu_outcome_attempted[$outcome->id] = 0;
60
+            $grad_stu_outcome_achieved[$outcome->id] = 0;
61
+            $attemptedGradProgramsPerOutcome[$outcome->id] = [];
62
+            $achievedGradProgramsPerOutcome[$outcome->id] = [];
63
+        }
64
+
41 65
         /**
42 66
          * List of grouped courses (grouped sections)
43 67
          */
@@ -51,6 +75,8 @@ class SchoolsController extends \BaseController
51 75
             ->orderBy('name', 'ASC')
52 76
             ->get();
53 77
 
78
+
79
+
54 80
         $grad_programs = DB::table('programs')
55 81
             ->select('id', 'name', 'school_id', 'is_graduate')
56 82
             ->where('is_graduate', '=', 1)
@@ -59,6 +85,139 @@ class SchoolsController extends \BaseController
59 85
             ->get();
60 86
 
61 87
 
88
+        //quiero ver si monto el query tm aqui
89
+
90
+        $undergrad_programs_list = DB::table('programs')
91
+            ->select('id', 'name', 'school_id', 'is_graduate')
92
+            ->where('is_graduate', '=', 0)
93
+            ->where('school_id', '=', $id)
94
+            ->orderBy('name', 'ASC')
95
+            ->lists('id');
96
+
97
+        $grad_programs_list = DB::table('programs')
98
+            ->select('id', 'name', 'school_id', 'is_graduate')
99
+            ->where('is_graduate', '=', 1)
100
+            ->where('school_id', '=', $id)
101
+            ->orderBy('name', 'ASC')
102
+            ->lists('id');
103
+
104
+
105
+        $undergraduate_student_query = DB::table("courses")
106
+            ->join('activities', 'activities.course_id', '=', 'courses.id')
107
+            ->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
108
+            ->join('assessments', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
109
+            ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
110
+            ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
111
+            ->join('criterion_objective_outcome as cobo', 'cobo.criterion_id', '=', 'activity_criterion.criterion_id')
112
+            ->join('program_criterion_objective_outcome as poco', function ($q) {
113
+                $q->on('courses.program_id', '=', 'poco.program_id')
114
+                    ->on('cobo.id', '=', 'poco.cri_obj_out_id');
115
+            })
116
+            ->join('students', 'students.id', '=', 'assessments.student_id')
117
+            ->whereIn('poco.program_id',  $undergrad_programs_list)
118
+            ->whereIn("courses.semester_id", Session::get('semesters_ids'))
119
+            ->whereIn('courses.program_id',  $undergrad_programs_list)
120
+            ->select('students.number as student_id')
121
+            ->addSelect(DB::raw('count(assessments.activity_criterion_id) as criteria_attempted'))
122
+            ->addSelect(DB::raw('count(case when assessments.score>=rubrics.expected_points then 1 else NULL end) as criteria_achieved'))
123
+            ->addSelect('outcome_id')
124
+            ->groupBy(array('students.id', 'outcome_id'))
125
+            ->get();
126
+
127
+
128
+        Log::info($undergraduate_student_query);
129
+
130
+        $grad_student_query = DB::table("courses")
131
+            ->join('activities', 'activities.course_id', '=', 'courses.id')
132
+            ->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
133
+            ->join('assessments', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
134
+            ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
135
+            ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
136
+            ->join('criterion_objective_outcome as cobo', 'cobo.criterion_id', '=', 'activity_criterion.criterion_id')
137
+            ->join('program_criterion_objective_outcome as poco', function ($q) {
138
+                $q->on('courses.program_id', '=', 'poco.program_id')
139
+                    ->on('cobo.id', '=', 'poco.cri_obj_out_id');
140
+            })
141
+            ->join('students', 'students.id', '=', 'assessments.student_id')
142
+            ->whereIn('poco.program_id',  $grad_programs_list)
143
+            ->whereIn("courses.semester_id", Session::get('semesters_ids'))
144
+            ->whereIn('courses.program_id',  $grad_programs_list)
145
+            ->select('students.number as student_id')
146
+            ->addSelect(DB::raw('count(assessments.activity_criterion_id) as criteria_attempted'))
147
+            ->addSelect(DB::raw('count(case when assessments.score>=rubrics.expected_points then 1 else NULL end) as criteria_achieved'))
148
+            ->addSelect('outcome_id')
149
+            ->groupBy(array('students.id', 'outcome_id'))
150
+            ->get();
151
+
152
+        //school
153
+
154
+
155
+
156
+        /*
157
+            student x, crit achieved, crit attempted, outcome 1
158
+            student x, crit achieved, crit attempted, outcome 2
159
+            student x, crit achieved, crit attempted, outcome 3
160
+            student x, crit achieved, crit attempted, outcome 4
161
+            student y, crit achieved, crit attempted, outcome 1
162
+            student y, crit achieved, crit attempted, outcome 2
163
+            student y, crit achieved, crit attempted, outcome 3
164
+            ....
165
+            
166
+
167
+            */
168
+
169
+        $grad_outcomes_attempted = [];
170
+        $grad_outcomes_achieved = [];
171
+        $undergrad_outcomes_attempted = [];
172
+        $undergrad_outcomes_achieved = [];
173
+
174
+        foreach ($outcomes_grad as $outcome) {
175
+            $grad_outcomes_attempted[$outcome->id] = 0;
176
+            $grad_outcomes_achieved[$outcome->id] = 0;
177
+        }
178
+
179
+        foreach ($outcomes_undergrad as $outcome) {
180
+            $undergrad_outcomes_attempted[$outcome->id] = 0;
181
+            $undergrad_outcomes_achieved[$outcome->id] = 0;
182
+        }
183
+
184
+        foreach ($grad_student_query as $result) {
185
+            if ($result->criteria_attempted != 0) {
186
+                if (!isset($grad_outcomes_attempted[$result->outcome_id]))
187
+                    continue;
188
+
189
+                $grad_outcomes_attempted[$result->outcome_id]++;
190
+
191
+                $percent = $result->criteria_achieved / $result->criteria_attempted * 100;
192
+
193
+                if ($percent >= 66.66) {
194
+
195
+
196
+                    $grad_outcomes_achieved[$result->outcome_id]++;
197
+                }
198
+            }
199
+        }
200
+
201
+
202
+
203
+
204
+        foreach ($undergraduate_student_query as $result) {
205
+            if ($result->criteria_attempted != 0) {
206
+                if (!isset($undergrad_outcomes_attempted[$result->outcome_id]))
207
+                    continue;
208
+
209
+                $undergrad_outcomes_attempted[$result->outcome_id]++;
210
+
211
+                $percent = $result->criteria_achieved / $result->criteria_attempted * 100;
212
+
213
+                if ($percent >= 66.66) {
214
+
215
+
216
+                    $undergrad_outcomes_achieved[$result->outcome_id]++;
217
+                }
218
+            }
219
+        }
220
+
62 221
         $grad_grouped_courses = Course::
63 222
             //             select(DB::raw('courses.name, courses.code, courses.number, max(courses.outcomes_attempted) as outcomes_attempted, courses.semester_id, courses.program_id'))
64 223
             select(DB::raw('courses.name, courses.code, courses.number, courses.semester_id, courses.program_id'))
@@ -135,11 +294,116 @@ class SchoolsController extends \BaseController
135 294
             }
136 295
         }
137 296
 
297
+
298
+        //como resuelvo programsAttempted y eso
299
+
300
+
301
+        //El query es el mismo de students, lo unico que dividido con programas,
302
+        //asi que lo que esta haciendo es, prog 1, y coge los dominios y estudiantes que evaluason
303
+
304
+
305
+        $undergrad_prog_attempted =  DB::table("courses")
306
+            ->join('activities', 'activities.course_id', '=', 'courses.id')
307
+            ->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
308
+            ->join('assessments', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
309
+            ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
310
+            ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
311
+            ->join('criterion_objective_outcome as cobo', 'cobo.criterion_id', '=', 'activity_criterion.criterion_id')
312
+            ->join('program_criterion_objective_outcome as poco', function ($q) {
313
+                $q->on('courses.program_id', '=', 'poco.program_id')
314
+                    ->on('cobo.id', '=', 'poco.cri_obj_out_id');
315
+            })
316
+            ->join('students', 'students.id', '=', 'assessments.student_id')
317
+            ->whereIn("courses.semester_id", Session::get('semesters_ids'))
318
+            ->whereIn('poco.program_id',  $undergrad_programs_list)
319
+
320
+            ->whereIn('courses.program_id',  $undergrad_programs_list)
321
+            ->select('students.number as student_id')
322
+            ->addSelect(DB::raw('count(assessments.activity_criterion_id) as criteria_attempted'))
323
+            ->addSelect(DB::raw('count(case when assessments.score>=rubrics.expected_points then 1 else NULL end) as criteria_achieved'))
324
+            ->addSelect('outcome_id')
325
+            ->addSelect("courses.program_id")
326
+            ->groupBy(array('students.id', 'outcome_id', 'program_id'))
327
+            ->get();
328
+
329
+        $grad_prog_attempted =  DB::table("courses")
330
+            ->join('activities', 'activities.course_id', '=', 'courses.id')
331
+            ->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
332
+            ->join('assessments', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
333
+            ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
334
+            ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
335
+            ->join('criterion_objective_outcome as cobo', 'cobo.criterion_id', '=', 'activity_criterion.criterion_id')
336
+            ->join('program_criterion_objective_outcome as poco', function ($q) {
337
+                $q->on('courses.program_id', '=', 'poco.program_id')
338
+                    ->on('cobo.id', '=', 'poco.cri_obj_out_id');
339
+            })
340
+            ->join('students', 'students.id', '=', 'assessments.student_id')
341
+            ->whereIn("courses.semester_id", Session::get('semesters_ids'))
342
+            ->whereIn('poco.program_id',  $grad_programs_list)
343
+
344
+            ->whereIn('courses.program_id',  $grad_programs_list)
345
+            ->select('students.number as student_id')
346
+            ->addSelect(DB::raw('count(assessments.activity_criterion_id) as criteria_attempted'))
347
+            ->addSelect(DB::raw('count(case when assessments.score>=rubrics.expected_points then 1 else NULL end) as criteria_achieved'))
348
+            ->addSelect('outcome_id')
349
+            ->addSelect("courses.program_id")
350
+            ->groupBy(array('students.id', 'outcome_id', 'program_id'))
351
+            ->get();
352
+
353
+        //este arreglo va a tener attempted[outcome->id][program->id]
354
+
355
+        //so la cardinalidad de attempted[outcome->id] dice cuantos programas intentaron, achieved[outcome->id], va 
356
+        //a decir cuantos pasaron y attempted[outcome->id][program->id] la suma de estudiantes que intentaron
357
+        // 
358
+
359
+
360
+        foreach ($undergrad_prog_attempted as $row) {
361
+            $program_id = $row->program_id;
362
+            $outcome_id = $row->outcome_id;
363
+            if (!isset($attemptedUndergradProgramsPerOutcome[$outcome_id][$program_id]))
364
+                $attemptedUndergradProgramsPerOutcome[$outcome_id][$program_id] = 0;
365
+
366
+
367
+            $attemptedUndergradProgramsPerOutcome[$outcome_id][$program_id]++;
368
+
369
+            $criteria_attempted_by_stu = $row->criteria_attempted;
370
+            $criteria_achieved_by_stu = $row->criteria_achieved;
371
+            if ($criteria_attempted_by_stu != 0 && $criteria_achieved_by_stu / $criteria_attempted_by_stu * 100 >= 66.67) {
372
+
373
+                if (!isset($achievedUndergradProgramsPerOutcome[$outcome_id][$program_id]))
374
+                    $achievedUndergradProgramsPerOutcome[$outcome_id][$program_id] = 0;
375
+                $achievedUndergradProgramsPerOutcome[$outcome_id][$program_id]++;
376
+            }
377
+        }
378
+
379
+        foreach ($grad_prog_attempted as $row) {
380
+            $program_id = $row->program_id;
381
+            $outcome_id = $row->outcome_id;
382
+            if (!isset($attemptedGradProgramsPerOutcome[$outcome_id][$program_id]))
383
+                $attemptedGradProgramsPerOutcome[$outcome_id][$program_id] = 0;
384
+
385
+
386
+            $attemptedGradProgramsPerOutcome[$outcome_id][$program_id]++;
387
+
388
+            $criteria_attempted_by_stu = $row->criteria_attempted;
389
+            $criteria_achieved_by_stu = $row->criteria_achieved;
390
+            if ($criteria_attempted_by_stu != 0 && $criteria_achieved_by_stu / $criteria_attempted_by_stu * 100 >= 66.67) {
391
+                if (!isset($achievedGradProgramsPerOutcome[$outcome_id][$program_id]))
392
+                    $achievedGradProgramsPerOutcome[$outcome_id][$program_id] = 0;
393
+                $achievedGradProgramsPerOutcome[$outcome_id][$program_id]++;
394
+            }
395
+        }
396
+
397
+
398
+
399
+
400
+
138 401
         /**
139 402
          * Calculate how many programs achieved and attempted each outcome in this school
140 403
          */
141 404
 
142 405
         // For each outcome 
406
+        /*
143 407
         foreach ($outcomes_undergrad as $outcome) {
144 408
             //         	$attempted_outcomes_per_undergrad_program[$outcome->id]=0;
145 409
             //         	$achieved_outcomes_per_undergrad_program[$outcome->id]=0;
@@ -168,12 +432,12 @@ class SchoolsController extends \BaseController
168 432
                 //                 $query->whereNotNull('outcomes_attempted');
169 433
                 $query->whereIn('semester_id', Session::get('semesters_ids'));
170 434
             }))->where('is_graduate', 0)->where('school_id', $school->id)->orderBy('name', 'asc')->get();
171
-        }
435
+        }*/
172 436
 
173 437
         /**
174 438
          * Calculate how many Graduate programs achieved and attempted each outcome in this school
175 439
          */
176
-
440
+        /*
177 441
         // For each outcome 
178 442
         foreach ($outcomes_grad as $outcome) {
179 443
             //         	$attempted_outcomes_per_grad_program[$outcome->id]=0;
@@ -203,7 +467,7 @@ class SchoolsController extends \BaseController
203 467
                 //                 $query->whereNotNull('outcomes_attempted');
204 468
                 $query->whereIn('semester_id', Session::get('semesters_ids'));
205 469
             }))->where('is_graduate', 1)->where('school_id', $school->id)->orderBy('name', 'asc')->get();
206
-        }
470
+        }*/
207 471
         if ($school->id == 13) {
208 472
             //             return View::make('local.managers.shared.school-uhs', compact('title', 'outcomes', 'undergrad_programs', 'grad_programs', 'undergrad_outcomes_attempted', 'grad_outcomes_attempted', 'undergrad_outcomes_achieved', 'grad_outcomes_achieved', 'schools', 'school', 'undergrad_assessed_sections_count', 'grad_assessed_sections_count', 'undergrad_school_sections_count', 'grad_school_sections_count', 'achievedUndergradProgramsPerOutcome', 'achievedGradProgramsPerOutcome', 'attemptedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'grad_grouped_courses', 'undergrad_grouped_courses', 'participating_programs', 'participating_undergrad_programs', 'participating_grad_programs'));
209 473
             return View::make('local.managers.shared.school-uhs', compact('title', 'outcomes_grad', 'outcomes_undergrad', 'undergrad_programs', 'grad_programs', 'undergrad_outcomes_attempted', 'grad_outcomes_attempted', 'undergrad_outcomes_achieved', 'grad_outcomes_achieved', 'schools', 'school', 'undergrad_assessed_sections_count', 'grad_assessed_sections_count', 'undergrad_school_sections_count', 'grad_school_sections_count', 'achievedUndergradProgramsPerOutcome', 'achievedGradProgramsPerOutcome', 'attemptedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'grad_grouped_courses', 'undergrad_grouped_courses', 'participating_programs'));
@@ -213,31 +477,30 @@ class SchoolsController extends \BaseController
213 477
         }
214 478
     }
215 479
 
216
-	private function cmp($a, $b) 
217
-	{
218
-		return strcmp($a->name, $b->name);
219
-	}
480
+    private function cmp($a, $b)
481
+    {
482
+        return strcmp($a->name, $b->name);
483
+    }
220 484
 
221 485
     public function studentSchoolAssessmentReport($school_id)
222 486
     {
223
-		$id=$school_id;
224
-		ini_set('memory_limit', -1);
225
-		ini_set('max_execution_time', 300);
226
-	
227
-		$outcomes = Outcome::orderBy('name', 'asc')->get();
228
-		$school = School::find($school_id);
229
-		$title= $school->name;
230
-		$outcomeCount = Outcome::all()->count();
231
-		$programs=Program::where('school_id','=',$school_id)->get();
232
-		$programs_ids=array();
233
-// 				var_dump($programs);exit();
234
-		$programs_name=array();
235
-		foreach($programs as $program)
236
-		{
237
-// 			var_dump($program);
238
-			$programs_ids[]=$program->id;
239
-			$programs_name[$program->id]=$program->name;
240
-		}
487
+        $id = $school_id;
488
+        ini_set('memory_limit', -1);
489
+        ini_set('max_execution_time', 300);
490
+
491
+        $outcomes = Outcome::orderBy('name', 'asc')->get();
492
+        $school = School::find($school_id);
493
+        $title = $school->name;
494
+        $outcomeCount = Outcome::all()->count();
495
+        $programs = Program::where('school_id', '=', $school_id)->get();
496
+        $programs_ids = array();
497
+        // 				var_dump($programs);exit();
498
+        $programs_name = array();
499
+        foreach ($programs as $program) {
500
+            // 			var_dump($program);
501
+            $programs_ids[] = $program->id;
502
+            $programs_name[$program->id] = $program->name;
503
+        }
241 504
 
242 505
         $grouped_courses = Course::
243 506
             //             select(DB::raw('courses.name, courses.code, courses.number, max(courses.outcomes_attempted) as outcomes_attempted, courses.semester_id, courses.program_id'))
@@ -254,219 +517,175 @@ class SchoolsController extends \BaseController
254 517
             ->get();
255 518
 
256 519
 
257
-		$role=Auth::user()->role;
258
-
259
-		$users =array();
260
-
261
-
262
-		$resultados_todos_obj = DB::table('assessments')
263
-         						->join('activity_criterion', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
264
-         						->join('activities', 'activities.id', '=', 'activity_criterion.activity_id')
265
-         						->join('courses', 'courses.id', '=', 'activities.course_id')
266
-         						->join('students', 'students.id', '=', 'assessments.student_id')
267
-         						->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id')
268
-         						->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
269
-         						->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
270
-         						->join('semesters', 'semesters.id', '=', 'courses.semester_id')
271
-          						->whereIn('students.program_id',$programs_ids)
272
-                   			   	->whereIn('semester_id', Session::get('semesters_ids'))
273
-                   			   	->where('semesters.is_visible','=',1)
274
-                    			->select('student_id', 'students.program_id', 'semesters.code', 'outcome_id', 'criterion_objective_outcome.criterion_id','score','expected_points')
275
-								->distinct()
276
-                    			->get();
277
-
278
-		foreach($resultados_todos_obj as $resultado)
279
-		{
280
-			if(!isset($resultados_todos[$resultado->program_id][$resultado->outcome_id]['semesters']))
281
-			{
282
-				$resultados_todos[$resultado->program_id][$resultado->outcome_id]['semesters']=array();
283
-			}
284
-			$resultados_todos[$resultado->program_id][$resultado->outcome_id]['semesters'][]=$resultado->code;
285
-			$resultados_todos[$resultado->program_id][$resultado->outcome_id]['semesters']=array_unique($resultados_todos[$resultado->program_id][$resultado->outcome_id]['semesters']);
286
-			if(!isset($resultados_todos[$resultado->program_id][$resultado->outcome_id][$resultado->student_id]['attempted']))
287
-			{
288
-				$resultados_todos[$resultado->program_id][$resultado->outcome_id][$resultado->student_id]['attempted']=0;
289
-			}
290
-			$resultados_todos[$resultado->program_id][$resultado->outcome_id][$resultado->student_id]['attempted']++;
291
-
292
-			if(!isset($resultados_todos[$resultado->program_id][$resultado->outcome_id][$resultado->student_id]['achieved']))
293
-			{
294
-				$resultados_todos[$resultado->program_id][$resultado->outcome_id][$resultado->student_id]['achieved']=0;
295
-			}
296
-			if($resultado->score>=$resultado->expected_points)
297
-			{
298
-				$resultados_todos[$resultado->program_id][$resultado->outcome_id][$resultado->student_id]['achieved']++;
299
-			}
300
-		}
301
-
302
-		$outcomes_colap=array();
303
-		$programs=array();
304
-// 			$outcomes_colap=array();
305
-		$i=0;
306
-		$outcomes_attempted=array();
307
-		$outcomes_attempted_colap=array();
308
-		$outcomes_achieved_colap=array();
309
-		$outcomes_attempted_semesters=array();
310
-		foreach($resultados_todos as $program_id => $resultados_prog)
311
-		{
312
-	     	$outcomes_attempted_semesters[$program_id]=array();
313
-			foreach($resultados_prog as $out=>$datos_out)
314
-			{
315
-				$outcomes_achieved[$program_id][$out] = 0;
316
-				$outcomes_attempted[$program_id][$out] = 0;
317
-// 				var_dump($datos_out);outcomes_attempted_semesters
318
-				$outcomes_attempted_semesters[$program_id][$out]=$datos_out['semesters'];
319
-				unset($datos_out['semesters']);
320
-// 				var_dump($outcomes_attempted_semesters[$program_id][$out]);
321
-// 				var_dump($datos_out);
322
-// 				exit();
323
-				foreach($datos_out as $res)
324
-				{
325
-					$outcomes_attempted[$program_id][$out]++;
326
-					if(3*$res['achieved']>=2*$res['attempted'])
327
-						$outcomes_achieved[$program_id][$out]++;
328
-				}		
329
-			}
330
-			$programs[]=Program::find($program_id);
331
-			if(Program::find($program_id)->is_graduate)
332
-			{
333
-				$colapso=array(1=>array(),3=>array(),2=>array(11),12=>array(7,14),10=>array(),4=>array(6,15));
334
-			}
335
-			else
336
-			{
337
-				$colapso=array(10=>array(),1=>array(),12=>array(7),3=>array(9,8,14),2=>array(11),5=>array(),4=>array(6,13),16=>array());
338
-			}	
339
-		
340
-			$resultados_todos_colap[$program_id]=array();
341
-			foreach($colapso as $out=>$pares)
342
-			{
343
-				$resultados_todos_colap[$program_id][$out]["semesters"]=array();
344
-				if(isset($resultados_todos[$program_id][$out]))
345
-					$resultados_todos_colap[$program_id][$out]=$resultados_todos[$program_id][$out];
346
-					else $resultados_todos_colap[$program_id][$out]=array();
347
-				foreach($pares as $par)
348
-				{
349
-					if(isset($resultados_todos[$program_id][$par]))
350
-					{	
351
-// 						unset($resultados_todos[$program_id][$par]['semesters']);
352
-						
353
-						foreach($resultados_todos[$program_id][$par] as $estu => $resus)
354
-						{
355
-							if($estu!="semesters")
356
-							{
357
-								if(!isset($resultados_todos_colap[$program_id][$out][$estu]))
358
-								{
359
-									$resultados_todos_colap[$program_id][$out][$estu]['attempted']=0;
360
-									$resultados_todos_colap[$program_id][$out][$estu]['achieved']=0;
361
-
362
-								}
363
-	// 							print $program_id." ".$par." ".$estu."<br>";
364
-	// 							var_dump($resultados_todos[$program_id][$par][$estu]); 
365
-								$resultados_todos_colap[$program_id][$out][$estu]['attempted']+=$resultados_todos[$program_id][$par][$estu]['attempted'];
366
-								$resultados_todos_colap[$program_id][$out][$estu]['achieved']+=$resultados_todos[$program_id][$par][$estu]['achieved'];
367
-							}
368
-							else if(isset($resultados_todos[$program_id][$par]["semesters"]))
369
-							{
370
-								if(isset($resultados_todos_colap[$program_id][$out]["semesters"]))
371
-								{
372
-									$tmp=array_merge($resultados_todos_colap[$program_id][$out]["semesters"],$resultados_todos[$program_id][$par]["semesters"]);
373
-// 									var_dump(($tmp));
374
-// 									var_dump(array_unique($tmp));
375
-// 									exit();
376
-
377
-									$resultados_todos_colap[$program_id][$out]["semesters"]=array_unique($tmp);
378
-								}
379
-								else 
380
-									$resultados_todos_colap[$program_id][$out]["semesters"]=array_unique($resultados_todos[$program_id][$par]["semesters"]);
381
-							}
382
-						}
383
-					}
384
-				}
385
-		
386
-			}
387
-// 			var_dump($resultados_todos_colap);
388
-			
389
-			$outcomes_attempted_colap[$program_id]=array();
390
-			$outcomes_achieved_colap[$program_id]=array();
391
-			$outcomes_attempted_colap_semesters[$program_id]=array();
392
-// 			print $program_id."<br>";
393
-// 				var_dump($resultados_todos_colap[$program_id]);
394
-// 			print "<br>";
395
-			foreach($resultados_todos_colap[$program_id] as $out=>$datos_out)
396
-			{
397
-				if(!$i)$outcomes_colap[]=Outcome::find($out);
398
-// 				$outcomes_attempted_colap_semesters[$program_id][$out]=array();
399
-				if(isset($datos_out['semesters']))
400
-				{
401
-					$outcomes_attempted_colap_semesters[$program_id][$out]=$datos_out['semesters'];
402
-					unset($datos_out['semesters']);
403
-				}
404
-				foreach($datos_out as $res)
405
-				{
406
-					if(!isset($outcomes_attempted_colap[$program_id][$out]))
407
-					{
408
-						$outcomes_attempted_colap[$program_id][$out]=0;
409
-						$outcomes_achieved_colap[$program_id][$out]=0;
410
-					
411
-					}
412
-					$outcomes_attempted_colap[$program_id][$out]++;
413
-					if(3*$res['achieved']>=2*$res['attempted'])
414
-						$outcomes_achieved_colap[$program_id][$out]++;
415
-				}
416
-				if(empty($datos_out))
417
-				{
418
-					$outcomes_attempted_colap[$program_id][$out]=0;
419
-					$outcomes_achieved_colap[$program_id][$out]=0;
420
-				}
421
-
422
-			}
423
-			$i++;
424
-		}		
425
-		usort($outcomes_colap, array($this, "cmp"));
426
-	// 		var_dump($outcomes_attempted_colap); print "<br>";
427
-	// 		var_dump($outcomes_achieved_colap); print "<br>";
428
-	// 	exit();
429
-		$outcomes_attempted_colap_todo=array();
430
-		$outcomes_achieved_colap_todo=array();
431
-		foreach($outcomes_attempted_colap as $program_id => $out_res)
432
-		{
433
-			foreach($out_res as $out=>$res)
434
-			{
435
-				if(!isset($outcomes_attempted_colap_todo[$out]))
436
-				{
437
-					$outcomes_attempted_colap_todo[$out]=0;
438
-					$outcomes_achieved_colap_todo[$out]=0;
439
-			
440
-				}
441
-				$outcomes_attempted_colap_todo[$out]+=$outcomes_attempted_colap[$program_id][$out];
442
-				$outcomes_achieved_colap_todo[$out]+=$outcomes_achieved_colap[$program_id][$out];
443
-		
444
-		
445
-			}
446
-	
447
-		}
448
-		$outcomes_attempted_todo=array();
449
-		$outcomes_achieved_todo=array();
450
-		foreach($outcomes_attempted as $program_id => $out_res)
451
-		{
452
-			foreach($out_res as $out=>$res)
453
-			{
454
-				if(!isset($outcomes_attempted_todo[$out]))
455
-				{
456
-					$outcomes_attempted_todo[$out]=0;
457
-					$outcomes_achieved_todo[$out]=0;
458
-			
459
-				}
460
-				$outcomes_attempted_todo[$out]+=$outcomes_attempted[$program_id][$out];
461
-				$outcomes_achieved_todo[$out]+=$outcomes_achieved[$program_id][$out];
462
-		
463
-		
464
-			}
465
-	
466
-		}
467
-	
468
-
469
-	    return View::make('local.managers.shared.school_student_result', compact('title','outcomes_attempted_colap_semesters','outcomes_attempted_semesters','outcomes_attempted_colap_todo','outcomes_achieved_colap_todo','outcomes_attempted_todo','outcomes_achieved_todo','school','programs_name','role','outcomes','outcomes_colap', 'outcomes_attempted', 'outcomes_achieved', 'outcomes_attempted_colap', 'outcomes_achieved_colap', 'programs', 'users','program_courses','grouped_courses'));
520
+        $role = Auth::user()->role;
521
+
522
+        $users = array();
523
+
524
+
525
+        $resultados_todos_obj = DB::table('assessments')
526
+            ->join('activity_criterion', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
527
+            ->join('activities', 'activities.id', '=', 'activity_criterion.activity_id')
528
+            ->join('courses', 'courses.id', '=', 'activities.course_id')
529
+            ->join('students', 'students.id', '=', 'assessments.student_id')
530
+            ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id')
531
+            ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
532
+            ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
533
+            ->join('semesters', 'semesters.id', '=', 'courses.semester_id')
534
+            ->whereIn('students.program_id', $programs_ids)
535
+            ->whereIn('semester_id', Session::get('semesters_ids'))
536
+            ->where('semesters.is_visible', '=', 1)
537
+            ->select('student_id', 'students.program_id', 'semesters.code', 'outcome_id', 'criterion_objective_outcome.criterion_id', 'score', 'expected_points')
538
+            ->distinct()
539
+            ->get();
540
+
541
+        foreach ($resultados_todos_obj as $resultado) {
542
+            if (!isset($resultados_todos[$resultado->program_id][$resultado->outcome_id]['semesters'])) {
543
+                $resultados_todos[$resultado->program_id][$resultado->outcome_id]['semesters'] = array();
544
+            }
545
+            $resultados_todos[$resultado->program_id][$resultado->outcome_id]['semesters'][] = $resultado->code;
546
+            $resultados_todos[$resultado->program_id][$resultado->outcome_id]['semesters'] = array_unique($resultados_todos[$resultado->program_id][$resultado->outcome_id]['semesters']);
547
+            if (!isset($resultados_todos[$resultado->program_id][$resultado->outcome_id][$resultado->student_id]['attempted'])) {
548
+                $resultados_todos[$resultado->program_id][$resultado->outcome_id][$resultado->student_id]['attempted'] = 0;
549
+            }
550
+            $resultados_todos[$resultado->program_id][$resultado->outcome_id][$resultado->student_id]['attempted']++;
551
+
552
+            if (!isset($resultados_todos[$resultado->program_id][$resultado->outcome_id][$resultado->student_id]['achieved'])) {
553
+                $resultados_todos[$resultado->program_id][$resultado->outcome_id][$resultado->student_id]['achieved'] = 0;
554
+            }
555
+            if ($resultado->score >= $resultado->expected_points) {
556
+                $resultados_todos[$resultado->program_id][$resultado->outcome_id][$resultado->student_id]['achieved']++;
557
+            }
558
+        }
559
+
560
+        $outcomes_colap = array();
561
+        $programs = array();
562
+        // 			$outcomes_colap=array();
563
+        $i = 0;
564
+        $outcomes_attempted = array();
565
+        $outcomes_attempted_colap = array();
566
+        $outcomes_achieved_colap = array();
567
+        $outcomes_attempted_semesters = array();
568
+        foreach ($resultados_todos as $program_id => $resultados_prog) {
569
+            $outcomes_attempted_semesters[$program_id] = array();
570
+            foreach ($resultados_prog as $out => $datos_out) {
571
+                $outcomes_achieved[$program_id][$out] = 0;
572
+                $outcomes_attempted[$program_id][$out] = 0;
573
+                // 				var_dump($datos_out);outcomes_attempted_semesters
574
+                $outcomes_attempted_semesters[$program_id][$out] = $datos_out['semesters'];
575
+                unset($datos_out['semesters']);
576
+                // 				var_dump($outcomes_attempted_semesters[$program_id][$out]);
577
+                // 				var_dump($datos_out);
578
+                // 				exit();
579
+                foreach ($datos_out as $res) {
580
+                    $outcomes_attempted[$program_id][$out]++;
581
+                    if (3 * $res['achieved'] >= 2 * $res['attempted'])
582
+                        $outcomes_achieved[$program_id][$out]++;
583
+                }
584
+            }
585
+            $programs[] = Program::find($program_id);
586
+            if (Program::find($program_id)->is_graduate) {
587
+                $colapso = array(1 => array(), 3 => array(), 2 => array(11), 12 => array(7, 14), 10 => array(), 4 => array(6, 15));
588
+            } else {
589
+                $colapso = array(10 => array(), 1 => array(), 12 => array(7), 3 => array(9, 8, 14), 2 => array(11), 5 => array(), 4 => array(6, 13), 16 => array());
590
+            }
591
+
592
+            $resultados_todos_colap[$program_id] = array();
593
+            foreach ($colapso as $out => $pares) {
594
+                $resultados_todos_colap[$program_id][$out]["semesters"] = array();
595
+                if (isset($resultados_todos[$program_id][$out]))
596
+                    $resultados_todos_colap[$program_id][$out] = $resultados_todos[$program_id][$out];
597
+                else $resultados_todos_colap[$program_id][$out] = array();
598
+                foreach ($pares as $par) {
599
+                    if (isset($resultados_todos[$program_id][$par])) {
600
+                        // 						unset($resultados_todos[$program_id][$par]['semesters']);
601
+
602
+                        foreach ($resultados_todos[$program_id][$par] as $estu => $resus) {
603
+                            if ($estu != "semesters") {
604
+                                if (!isset($resultados_todos_colap[$program_id][$out][$estu])) {
605
+                                    $resultados_todos_colap[$program_id][$out][$estu]['attempted'] = 0;
606
+                                    $resultados_todos_colap[$program_id][$out][$estu]['achieved'] = 0;
607
+                                }
608
+                                // 							print $program_id." ".$par." ".$estu."<br>";
609
+                                // 							var_dump($resultados_todos[$program_id][$par][$estu]); 
610
+                                $resultados_todos_colap[$program_id][$out][$estu]['attempted'] += $resultados_todos[$program_id][$par][$estu]['attempted'];
611
+                                $resultados_todos_colap[$program_id][$out][$estu]['achieved'] += $resultados_todos[$program_id][$par][$estu]['achieved'];
612
+                            } else if (isset($resultados_todos[$program_id][$par]["semesters"])) {
613
+                                if (isset($resultados_todos_colap[$program_id][$out]["semesters"])) {
614
+                                    $tmp = array_merge($resultados_todos_colap[$program_id][$out]["semesters"], $resultados_todos[$program_id][$par]["semesters"]);
615
+                                    // 									var_dump(($tmp));
616
+                                    // 									var_dump(array_unique($tmp));
617
+                                    // 									exit();
618
+
619
+                                    $resultados_todos_colap[$program_id][$out]["semesters"] = array_unique($tmp);
620
+                                } else
621
+                                    $resultados_todos_colap[$program_id][$out]["semesters"] = array_unique($resultados_todos[$program_id][$par]["semesters"]);
622
+                            }
623
+                        }
624
+                    }
625
+                }
626
+            }
627
+            // 			var_dump($resultados_todos_colap);
628
+
629
+            $outcomes_attempted_colap[$program_id] = array();
630
+            $outcomes_achieved_colap[$program_id] = array();
631
+            $outcomes_attempted_colap_semesters[$program_id] = array();
632
+            // 			print $program_id."<br>";
633
+            // 				var_dump($resultados_todos_colap[$program_id]);
634
+            // 			print "<br>";
635
+            foreach ($resultados_todos_colap[$program_id] as $out => $datos_out) {
636
+                if (!$i) $outcomes_colap[] = Outcome::find($out);
637
+                // 				$outcomes_attempted_colap_semesters[$program_id][$out]=array();
638
+                if (isset($datos_out['semesters'])) {
639
+                    $outcomes_attempted_colap_semesters[$program_id][$out] = $datos_out['semesters'];
640
+                    unset($datos_out['semesters']);
641
+                }
642
+                foreach ($datos_out as $res) {
643
+                    if (!isset($outcomes_attempted_colap[$program_id][$out])) {
644
+                        $outcomes_attempted_colap[$program_id][$out] = 0;
645
+                        $outcomes_achieved_colap[$program_id][$out] = 0;
646
+                    }
647
+                    $outcomes_attempted_colap[$program_id][$out]++;
648
+                    if (3 * $res['achieved'] >= 2 * $res['attempted'])
649
+                        $outcomes_achieved_colap[$program_id][$out]++;
650
+                }
651
+                if (empty($datos_out)) {
652
+                    $outcomes_attempted_colap[$program_id][$out] = 0;
653
+                    $outcomes_achieved_colap[$program_id][$out] = 0;
654
+                }
655
+            }
656
+            $i++;
657
+        }
658
+        usort($outcomes_colap, array($this, "cmp"));
659
+        // 		var_dump($outcomes_attempted_colap); print "<br>";
660
+        // 		var_dump($outcomes_achieved_colap); print "<br>";
661
+        // 	exit();
662
+        $outcomes_attempted_colap_todo = array();
663
+        $outcomes_achieved_colap_todo = array();
664
+        foreach ($outcomes_attempted_colap as $program_id => $out_res) {
665
+            foreach ($out_res as $out => $res) {
666
+                if (!isset($outcomes_attempted_colap_todo[$out])) {
667
+                    $outcomes_attempted_colap_todo[$out] = 0;
668
+                    $outcomes_achieved_colap_todo[$out] = 0;
669
+                }
670
+                $outcomes_attempted_colap_todo[$out] += $outcomes_attempted_colap[$program_id][$out];
671
+                $outcomes_achieved_colap_todo[$out] += $outcomes_achieved_colap[$program_id][$out];
672
+            }
673
+        }
674
+        $outcomes_attempted_todo = array();
675
+        $outcomes_achieved_todo = array();
676
+        foreach ($outcomes_attempted as $program_id => $out_res) {
677
+            foreach ($out_res as $out => $res) {
678
+                if (!isset($outcomes_attempted_todo[$out])) {
679
+                    $outcomes_attempted_todo[$out] = 0;
680
+                    $outcomes_achieved_todo[$out] = 0;
681
+                }
682
+                $outcomes_attempted_todo[$out] += $outcomes_attempted[$program_id][$out];
683
+                $outcomes_achieved_todo[$out] += $outcomes_achieved[$program_id][$out];
684
+            }
685
+        }
686
+
687
+
688
+        return View::make('local.managers.shared.school_student_result', compact('title', 'outcomes_attempted_colap_semesters', 'outcomes_attempted_semesters', 'outcomes_attempted_colap_todo', 'outcomes_achieved_colap_todo', 'outcomes_attempted_todo', 'outcomes_achieved_todo', 'school', 'programs_name', 'role', 'outcomes', 'outcomes_colap', 'outcomes_attempted', 'outcomes_achieved', 'outcomes_attempted_colap', 'outcomes_achieved_colap', 'programs', 'users', 'program_courses', 'grouped_courses'));
470 689
     }
471 690
 
472 691
     public function showQuasiOri($id)
@@ -916,4 +1135,4 @@ class SchoolsController extends \BaseController
916 1135
 
917 1136
         return View::make('local.managers.shared.print_school', compact('title', 'outcomes', 'outcomes_attempted', 'outcomes_achieved', 'school', 'assessed_sections_count', 'school_sections_count', 'achievedProgramsPerOutcome', 'attemptedProgramsPerOutcome', 'grouped_courses', 'participating_programs'));
918 1137
     }
919
-}
1138
+}

+ 68
- 39
app/controllers/TemplatesController.php View File

@@ -125,7 +125,10 @@ class TemplatesController extends \BaseController
125 125
 
126 126
 		$template->criteria = DB::table('criteria')
127 127
 			->join('template_criterion', 'template_criterion.criterion_id', '=', 'criteria.id')
128
+
128 129
 			->where('template_id', $template->id)
130
+			->select('criteria.*', 'criteria.id as criterion_id', 'template_criterion.id as template_criterion_id')
131
+
129 132
 			->orderBy('position')
130 133
 			->get();
131 134
 
@@ -196,7 +199,6 @@ class TemplatesController extends \BaseController
196 199
 	public function newTemplateProf()
197 200
 	{
198 201
 		return $this->newTemplate_new();
199
-			
200 202
 	}
201 203
 	public function newTemplate_new()
202 204
 	{
@@ -214,19 +216,19 @@ class TemplatesController extends \BaseController
214 216
 			$templates = Template::orderBy('name', 'ASC')->get();
215 217
 			$programs = Program::orderBy('name', 'ASC')->get();
216 218
 			$criteria = Criterion::orderBy('name', 'ASC')->get();
217
-			$school_id_user=NULL;
219
+			$school_id_user = NULL;
218 220
 		} else {
219 221
 			if ($role == 2) {
220 222
 				$programs = Auth::user()->school->programs;
221
-				$school_id_user=Auth::user()->school_id;
223
+				$school_id_user = Auth::user()->school_id;
222 224
 			}
223 225
 			if ($role == 3) {
224 226
 				$programs = Auth::user()->programs()->get();
225
-				$school_id_user=Auth::user()->programs[0]->school->id;
227
+				$school_id_user = Auth::user()->programs[0]->school->id;
226 228
 			}
227 229
 			if ($role == 4) {
228 230
 				$programs = Auth::user()->programs()->get();
229
-				$school_id_user=Auth::user()->programs[0]->school->id;
231
+				$school_id_user = Auth::user()->programs[0]->school->id;
230 232
 			}
231 233
 			Log::info(json_encode($school_id_user));
232 234
 			$program_ids = array();
@@ -239,52 +241,79 @@ class TemplatesController extends \BaseController
239 241
 					$q->whereIn('program_id', $program_ids);
240 242
 				}
241 243
 			)
242
-			->whereHas('getObjectivesAttribute', function ($q)
243
-				{
244
-					$q->where('objective_id','!=',0);
245
-				}
246
-			)
247
-			->orderBy('name', 'ASC')->get();
248
-			}
249
-// 			Log::info("aqui".(count($criteria)));
250
-// 			Log::info(json_encode(count($criteria)));
251
-			
252
-			$templates = Template::where('school_id', '=', $school_id_user)->orWhere('school_id', '=', NULL)
253
-				->orderBy('name', 'ASC')->get();
254
-			$criteria_ids = array();
255
-			
256
-			foreach ($criteria as $criterion) {
257
-				$criteria_ids[] = $criterion->id;
258
-			}
259
-			$templates_fuera = Template::whereHas('criteria', function ($q) use ($criteria_ids) {
260
-				$q->whereNotIn('criterion_id', $criteria_ids);
261
-			})
262
-				->orderBy('name', 'ASC')->get();
263
-				
264
-				
265
-			$templates_fuera_ids = array();
266
-			foreach ($templates_fuera as $tf) {
267
-				$templates_fuera_ids[] = $tf->id;
268
-			}
269
-// 			Log::info(json_encode($templates_fuera_ids));
270
-// exit();
271
-			$templates_dentro = Template::whereNotIn('id', $templates_fuera_ids)
244
+				->whereHas(
245
+					'getObjectivesAttribute',
246
+					function ($q) {
247
+						$q->where('objective_id', '!=', 0);
248
+					}
249
+				)
272 250
 				->orderBy('name', 'ASC')->get();
251
+		}
252
+		// 			Log::info("aqui".(count($criteria)));
253
+		// 			Log::info(json_encode(count($criteria)));
254
+
255
+		$templates = Template::where('school_id', '=', $school_id_user)->orWhere('school_id', '=', NULL)
256
+			->orderBy('name', 'ASC')->get();
257
+		$criteria_ids = array();
258
+
259
+		foreach ($criteria as $criterion) {
260
+			$criteria_ids[] = $criterion->id;
261
+		}
262
+		$templates_fuera = Template::whereHas('criteria', function ($q) use ($criteria_ids) {
263
+			$q->whereNotIn('criterion_id', $criteria_ids);
264
+		})
265
+			->orderBy('name', 'ASC')->get();
266
+
267
+
268
+		$templates_fuera_ids = array();
269
+		foreach ($templates_fuera as $tf) {
270
+			$templates_fuera_ids[] = $tf->id;
271
+		}
272
+		// 			Log::info(json_encode($templates_fuera_ids));
273
+		// exit();
274
+		$templates_dentro = Template::whereNotIn('id', $templates_fuera_ids)
275
+			->orderBy('name', 'ASC')->get();
273 276
 
274
-// 			if(!isset($templates_dentro))$templates_dentro=
277
+		// 			if(!isset($templates_dentro))$templates_dentro=
275 278
 
276
-			// 			var_dump(json_encode($templates_dentro));
277
-// 		}
279
+		// 			var_dump(json_encode($templates_dentro));
280
+		// 		}
278 281
 
279
-	$templates_fuera=array();
282
+		$templates_fuera = array();
280 283
 		return View::make('local.managers.shared.rubrics_new', compact('title', 'templates_dentro', 'templates_fuera', 'outcomes', 'criteria', 'schools', 'programs', 'criteria_ids'));
281 284
 	}
282 285
 
286
+
287
+	public function fetchObjectivesForTemplate()
288
+	{
289
+		$criteria_ids = Input::get("allCriteria");
290
+
291
+		$criteria = [];
292
+		//Acho im sorry pero no tengo idea porque sale un error que haría eso más eficiente.
293
+		foreach ($criteria_ids as $crit_id) {
294
+			$crit = Criterion::where('id', $crit_id)->first();
295
+			if (!isset($crit)) {
296
+				return "NO pa";
297
+			}
298
+
299
+			$crit->all_objectives = Objective::join("criterion_objective_outcome", 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
300
+				->where('criterion_id', $crit->id)
301
+				->select('objectives.*')
302
+				->groupBy('objectives.id')
303
+				->get();
304
+			$criteria[] = $crit;
305
+		}
306
+
307
+		return $criteria;
308
+	}
309
+
283 310
 	/**
284 311
 	 * Save a new rubric
285 312
 	 *
286 313
 	 * @return Response
287 314
 	 */
315
+
316
+
288 317
 	public function create()
289 318
 	{
290 319
 		DB::beginTransaction();

+ 6
- 4
app/models/Course.php View File

@@ -558,7 +558,9 @@ class Course extends Eloquent
558 558
         ->join('assessments', function ($join) {
559 559
           $join->on("assessments.student_id", '=', 'course_student.student_id')
560 560
             ->on('assessments.activity_criterion_id', '=', 'activity_criterion.id');
561
-        });
561
+        })
562
+        ->where('activities.draft', 0)
563
+        ->where('activities.diagnostic', 0);
562 564
 
563 565
 
564 566
       // si typ_semester_course esta prendido, then significa que es de los estudiantes del programa
@@ -613,9 +615,9 @@ class Course extends Eloquent
613 615
         $table_per_student = $table_per_student->addSelect('outcome_id')
614 616
           ->groupBy(array('students.id', 'outcome_id'));
615 617
 
616
-        Log::info($table_per_student->toSql());
617
-        Log::info($criteria_id);
618
-        Log::info("Amiga ponle a br");
618
+        // Log::info($table_per_student->toSql());
619
+        //Log::info($criteria_id);
620
+        //Log::info("Amiga ponle a br");
619 621
 
620 622
         $query = $table_per_student->get();
621 623
 

+ 1
- 1
app/models/Criterion.php View File

@@ -29,7 +29,7 @@ class Criterion extends Eloquent
29 29
 
30 30
 	public function getObjectivesAttribute()
31 31
 	{
32
-		return $this->belongsToMany('Objective','criterion_objective_outcome');
32
+		return $this->belongsToMany('Objective', 'criterion_objective_outcome');
33 33
 	}
34 34
 
35 35
 	public function rubrics()

+ 8
- 1
app/routes.php View File

@@ -223,6 +223,10 @@ Route::group(array('before' => 'auth|has_access'), function () {
223 223
     Route::post("fetch_assoc_courses", 'CoursesController@fetchCourses');
224 224
 
225 225
 
226
+    //Fetch Objectives for Template
227
+
228
+    Route::post("fetchObjectiveForTemplate", 'TemplatesController@fetchObjectivesForTemplate');
229
+
226 230
 
227 231
     //shared viewTransformativeActions
228 232
 
@@ -325,7 +329,10 @@ Route::group(array('before' => 'auth|has_access'), function () {
325 329
         'uses' => 'CriteriaController@fetchCriterionWithTrashed'
326 330
     ));
327 331
 
328
-    Route::get('learning-outcomes/show/{id}', 'OutcomesController@show');
332
+    Route::get('learning-outcomes/show/{id}', array(
333
+        'as' => "learning-outcomes/show/{id}",
334
+        'uses' => 'OutcomesController@show'
335
+    ));
329 336
     //Fetch objectives for criteria when outcome is chosen
330 337
     Route::post('fetchObjectivesForSelect', array(
331 338
         'as' => 'fetchObjectivesForSelect',

+ 1
- 1
app/views/local/managers/admins/learning-outcome_new.blade.php View File

@@ -31,7 +31,7 @@
31 31
                         <th>School</th>
32 32
                         <th>Criteria attempted for the outcome</th>
33 33
                         <th>Criteria achieved for the outcome </th>
34
-                        <th>Success rate</th>
34
+                        <th>Success rate</th> 
35 35
                     </thead>
36 36
                     <tbody>
37 37
                         @foreach($undergradResults["names"] as $id=>$undergradProgramName)

+ 63
- 28
app/views/local/managers/admins/learning-outcomes.blade.php View File

@@ -110,42 +110,77 @@
110 110
 
111 111
         <hr>
112 112
     </div>
113
+
114
+    
115
+<div class="modal fade" id="delete-outcome-modal">
116
+    <div class="modal-dialog modal-md">
117
+      <div class="modal-content">
118
+        <div class="modal-header">
119
+          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
120
+          <h4 class="modal-title text-center" id ="modal-title-rubric">Are you sure you want to delete this Learning Outcome?</h4>
121
+        </div>
122
+          <div class="modal-body" id ="delete-outcome-modal-body">
123
+              <p>You won't be able to retrieve it</p>
124
+  
125
+  
126
+  
127
+                 
128
+                  
129
+                  
130
+          </div>
131
+        <div class="modal-footer">
132
+              <button type="button" class="btn btn-default modal-but" data-dismiss="modal">Close</button>
133
+              <button type="button" class="btn btn-primary modal-but" id='modal-delete-button' data-dismiss="modal" onclick ="">Delete Outcome</button>
134
+            
135
+        </div>
136
+      </div><!-- /.modal-content -->
137
+    </div><!-- /.modal-dialog -->
138
+  </div>
139
+
140
+  <script>
141
+function deleteOutcome(outcome_id){
142
+    var outcomeObject = new Object();
143
+
144
+    outcomeObject.id= outcome_id;
145
+    outcomeObject.delete=1;
146
+    console.log("algo"+JSON.stringify(outcome_id));
147
+    console.log("algo"+JSON.stringify(outcomeObject));
148
+    var clone = jQuery.extend({}, outcomeObject);
149
+    //	outcomeArray.push(clone);
150
+    //	console.log("algo"+JSON.stringify(outcomeArray));
151
+    $.post(
152
+        "{{ URL::action('OutcomesController@delete') }}",
153
+        {    outcomeArray: JSON.stringify(outcomeObject)},
154
+    function(data)
155
+        {
156
+            location.reload();
157
+        }
158
+    );
159
+}
160
+    </script>
113 161
 @stop
114 162
 
115 163
 @section('javascript')
164
+
165
+$(".modal-but").on('click',function(e){
166
+    e.preventDefault();
167
+})
168
+
169
+
116 170
 @foreach ($outcomes as $outcome)
117 171
      $('#del{{ $outcome->id }}').on('click', function(e)
118 172
     {
119 173
     	e.preventDefault();
120 174
     	//outcomeObject.id= $(this).data('id');
121
-    	if(confirm("Are you sure you want to delete the outcome with id {{ $outcome->id }}"))
122
-    	{
123
-    		console.log("si");
124
-			var outcomeObject = new Object();
125
-
126
-			outcomeObject.id= {{ $outcome->id }};
127
-	    	outcomeObject.delete=1;
128
-	    	console.log("algo"+JSON.stringify({{ $outcome->id }}));
129
-	    	console.log("algo"+JSON.stringify(outcomeObject));
130
-			var clone = jQuery.extend({}, outcomeObject);
131
-		//	outcomeArray.push(clone);
132
-	    //	console.log("algo"+JSON.stringify(outcomeArray));
133
-			$.post(
134
-			"{{ URL::action('OutcomesController@delete') }}",
135
-			{ outcomeArray: JSON.stringify(outcomeObject)},
136
-			function(data)
137
-			{
138
-				location.reload();
139
-			}
140
-			);
141
-			
142
-   		}
143
-    	else 
144
-    	{
145
-	    	console.log("no");
146
-//			outcomeObject.delete=0;
147
-		}
148
-	});
175
+
176
+        $("#delete-outcome-modal").modal("show");
177
+        $("#modal-delete-button").attr('onclick', 'deleteOutcome({{$outcome->id}})')
178
+
179
+    }
180
+     );
181
+
182
+
183
+
149 184
 @endforeach
150 185
 
151 186
     $('#new_outcome_form').hide();

+ 68
- 1
app/views/local/managers/admins/view_template.blade.php View File

@@ -18,6 +18,8 @@
18 18
   <div class="col-md-12">
19 19
     <div class="btn-group pull-right">
20 20
       {{ HTML::linkAction('TemplatesController@printview', 'Print', array($template->id), array('class'=>'btn btn-default')) }}
21
+      <button class= 'btn btn-default' onclick ='fetchObjectivesForTemplate("#bodyRubric")'>View Objectives</button>
22
+   
21 23
     </div>
22 24
 
23 25
     <p>Passing Criteria:
@@ -42,7 +44,7 @@
42 44
         </thead>
43 45
       <tbody id ="bodyRubric">
44 46
         @foreach($template->criteria as $index=> $criterion)
45
-      <tr data-criterion-copyright="{{$criterion->copyright}}" data-criterion-notes="{{$criterion->notes}}">
47
+      <tr data-criterion-id = "{{$criterion->id}}" data-criterion-copyright="{{$criterion->copyright}}" data-criterion-notes="{{$criterion->notes}}">
46 48
         <td>{{$index+1}}.</td>
47 49
 
48 50
         @if($criterion->notes)
@@ -91,7 +93,72 @@
91 93
   </div>
92 94
 </div>
93 95
 
96
+
97
+<div class="modal fade" id="objectives-crit-modal">
98
+  <div class="modal-dialog modal-md">
99
+    <div class="modal-content">
100
+      <div class="modal-header">
101
+        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
102
+        <h4 class="modal-title text-center" id ="modal-title-rubric">These are the objectives in each Criterion in this Rubric</h4>
103
+      </div>
104
+        <div class="modal-body" id ="objectives-crit-modal-body">
105
+            
106
+
107
+
108
+
109
+               
110
+                
111
+                
112
+        </div>
113
+      <div class="modal-footer">
114
+            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
115
+          
116
+      </div>
117
+    </div><!-- /.modal-content -->
118
+  </div><!-- /.modal-dialog -->
119
+</div>
94 120
 <script> 
121
+
122
+function fetchObjectivesForTemplate(tbody){
123
+  
124
+  allCriteria = [];
125
+        $(tbody).children('tr').each(function (index){
126
+            allCriteria.push($(this).data('criterion-id'));
127
+        })
128
+        $.post(
129
+            "{{URL::action('TemplatesController@fetchObjectivesForTemplate')}}",
130
+            {
131
+                allCriteria:allCriteria
132
+            },
133
+
134
+            function(crit){
135
+                
136
+                modal_name = '#objectives-crit-modal';
137
+                $(modal_name+'-body').html(' ');
138
+                ol_crit = $("<ol>")
139
+                $(modal_name+'-body').append(ol_crit);
140
+                $.each(crit, function(index, cri){
141
+
142
+                    
143
+                    li = $("<li>").html("<strong>"+cri.name+"</strong>");
144
+                    
145
+                    ul_for_ob = $("<ul>");
146
+                    
147
+                        $.each(cri.all_objectives, function(ind, obj){
148
+                            li2 = $("<li>").html(obj.text)
149
+                            ul_for_ob.append(li2);
150
+                        })
151
+                        li.append(ul_for_ob);
152
+                    ol_crit.append(li);
153
+
154
+                    
155
+                })
156
+                $(modal_name).modal('show');
157
+
158
+            }
159
+        )
160
+    }
161
+
95 162
 /*
96 163
   function createTable(){
97 164
     $.post("{{URL::action('TemplatesController@onLoadFetch')}}",

+ 4
- 0
app/views/local/managers/shared/rubric_list.blade.php View File

@@ -36,7 +36,11 @@
36 36
             <tbody>
37 37
                 @foreach ($templates as $template)
38 38
                     <tr>
39
+                        @if($role==4)
39 40
                         <td>{{ HTML::linkAction('TemplatesController@profShow', $template->name, [$template->id]) }}</td>
41
+                        @else
42
+                        <td>{{ HTML::linkAction('TemplatesController@show', $template->name, [$template->id]) }}</td>
43
+                        @endif
40 44
                         <td>
41 45
                             @if ($template->school)
42 46
                                 {{ $template->school->name }}

+ 66
- 0
app/views/local/managers/shared/rubrics_new.blade.php View File

@@ -341,6 +341,7 @@
341 341
                     Delete
342 342
                 </button>
343 343
                 <button id="button-print-rubric" class="btn btn-lg btn-primary"><span class="glyphicon glyphicon-print"></span> Print <span class="small">(saved version)</span></button>
344
+                <button id = "button-get-criteria-objectives" class = "btn btn-lg btn-primary" onclick = 'fetchObjectivesForTemplate("#allCriteria")'><span class='glyphicon glyphicon-eye-open'></span> View Objectives</button>
344 345
             </div>
345 346
         </div>
346 347
     </div>
@@ -370,6 +371,31 @@
370 371
       </div><!-- /.modal-content -->
371 372
     </div><!-- /.modal-dialog -->
372 373
   </div>
374
+
375
+
376
+  <div class="modal fade" id="objectives-crit-modal">
377
+    <div class="modal-dialog modal-md">
378
+      <div class="modal-content">
379
+        <div class="modal-header">
380
+          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
381
+          <h4 class="modal-title text-center" id ="modal-title-rubric">These are the objectives in each Criterion in this Rubric</h4>
382
+        </div>
383
+          <div class="modal-body" id ="objectives-crit-modal-body">
384
+              
385
+  
386
+  
387
+ 
388
+                 
389
+                  
390
+                  
391
+          </div>
392
+        <div class="modal-footer">
393
+              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
394
+            
395
+        </div>
396
+      </div><!-- /.modal-content -->
397
+    </div><!-- /.modal-dialog -->
398
+  </div>
373 399
 <script>
374 400
 
375 401
     </script>
@@ -380,6 +406,46 @@
380 406
 <!-- jQuery Sortable Tables -->
381 407
 <script src="{{ asset('vendor/jQuerySortable/jquery-sortable-min.js') }}"></script>
382 408
 <script>
409
+
410
+    function fetchObjectivesForTemplate(tbody){
411
+
412
+        allCriteria = [];
413
+        $(tbody).children('tr').each(function (index){
414
+            allCriteria.push($(this).data('criterion-id'));
415
+        })
416
+        $.post(
417
+            "{{URL::action('TemplatesController@fetchObjectivesForTemplate')}}",
418
+            {
419
+                allCriteria:allCriteria
420
+            },
421
+
422
+            function(crit){
423
+                
424
+                modal_name = '#objectives-crit-modal';
425
+                $(modal_name+'-body').html(' ');
426
+                ol_crit = $("<ol>")
427
+                $(modal_name+'-body').append(ol_crit);
428
+                $.each(crit, function(index, cri){
429
+
430
+                    
431
+                    li = $("<li>").html("<strong>"+cri.name+"</strong>");
432
+                    
433
+                    ul_for_ob = $("<ul>");
434
+                    
435
+                        $.each(cri.all_objectives, function(ind, obj){
436
+                            li2 = $("<li>").html(obj.text)
437
+                            ul_for_ob.append(li2);
438
+                        })
439
+                        li.append(ul_for_ob);
440
+                    ol_crit.append(li);
441
+
442
+                    
443
+                })
444
+                $(modal_name).modal('show');
445
+
446
+            }
447
+        )
448
+    }
383 449
 function saveTemplate()
384 450
 {
385 451
     //Prevent page refresh

+ 34
- 18
app/views/local/managers/shared/school.blade.php View File

@@ -79,11 +79,11 @@
79 79
                                     @foreach($outcomes_undergrad as $outcome)
80 80
                                         <tr>
81 81
                                             <td class="col-md-6">{{ link_to_action('OutcomesController@show', $outcome->name, array($outcome->id), $attributes = array()) }}</td>
82
-                                            <td class="col-md-2">{{{ $attemptedUndergradProgramsPerOutcome[$outcome->id] }}}</td>
83
-                                            <td class="col-md-2">{{{ $achievedUndergradProgramsPerOutcome[$outcome->id] }}}</td>
82
+                                            <td class="col-md-2">{{{ count($attemptedUndergradProgramsPerOutcome[$outcome->id]) }}}</td>
83
+                                            <td class="col-md-2">{{{ count($achievedUndergradProgramsPerOutcome[$outcome->id]) }}}</td>
84 84
                                             <td class="col-md-2">
85
-                                                @if($attemptedUndergradProgramsPerOutcome[$outcome->id]!=0)
86
-                                                    {{{ round($achievedUndergradProgramsPerOutcome[$outcome->id] / $attemptedUndergradProgramsPerOutcome[$outcome->id]*100, 2) }}}%
85
+                                                @if(count($attemptedUndergradProgramsPerOutcome[$outcome->id])!=0)
86
+                                                    {{{ round( count($achievedUndergradProgramsPerOutcome[$outcome->id]) / count($attemptedUndergradProgramsPerOutcome[$outcome->id])*100, 2) }}}%
87 87
                                                 @else
88 88
                                                     N/M
89 89
                                                 @endif
@@ -274,11 +274,11 @@
274 274
                                     @foreach($outcomes_grad as $outcome)
275 275
                                         <tr>
276 276
                                             <td class="col-md-6">{{ link_to_action('OutcomesController@show', $outcome->name, array($outcome->id), $attributes = array()) }}</td>
277
-                                            <td class="col-md-2">{{{ $attemptedGradProgramsPerOutcome[$outcome->id] }}}</td>
278
-                                            <td class="col-md-2">{{{ $achievedGradProgramsPerOutcome[$outcome->id] }}}</td>
277
+                                            <td class="col-md-2">{{{ count($attemptedGradProgramsPerOutcome[$outcome->id]) }}}</td>
278
+                                            <td class="col-md-2">{{{ count($achievedGradProgramsPerOutcome[$outcome->id]) }}}</td>
279 279
                                             <td class="col-md-2">
280
-                                                @if($attemptedGradProgramsPerOutcome[$outcome->id]!=0)
281
-                                                    {{{ round($achievedGradProgramsPerOutcome[$outcome->id] / $attemptedGradProgramsPerOutcome[$outcome->id]*100, 2) }}}%
280
+                                                @if(count($attemptedGradProgramsPerOutcome[$outcome->id])!=0)
281
+                                                    {{{ round(count($achievedGradProgramsPerOutcome[$outcome->id]) / count($attemptedGradProgramsPerOutcome[$outcome->id])*100, 2) }}}%
282 282
                                                 @else
283 283
                                                     N/M
284 284
                                                 @endif
@@ -457,7 +457,7 @@ $(function () {
457 457
             xAxis: {
458 458
                 categories: [
459 459
                     @foreach($outcomes_undergrad as $outcome)
460
-                        "{{{ $outcome->name }}}",
460
+                        "{{{ $outcome->name }}},  <br> (N = {{$undergrad_outcomes_attempted[$outcome->id]}} ,{{$undergrad_outcomes_achieved[$outcome->id]}})",
461 461
                     @endforeach
462 462
                 ],
463 463
                 labels: {
@@ -497,7 +497,7 @@ $(function () {
497 497
                 groupPadding: 0.075
498 498
                 },
499 499
             },
500
-            series: [{
500
+            series: [/*{
501 501
                 name: 'Expected Value',
502 502
                 color: '#555555',
503 503
                 dataLabels: {
@@ -508,7 +508,7 @@ $(function () {
508 508
                     format: '{y:.1f}%',
509 509
                     style: {
510 510
                         //fontWeight: 'bold'
511
-                    },
511
+                    }, 
512 512
                     y:-1
513 513
                 },
514 514
                 data: [
@@ -524,7 +524,7 @@ $(function () {
524 524
                     @endforeach
525 525
                 ],
526 526
                 pointPadding: 0,
527
-            }, {
527
+            },*/ {
528 528
                 name: 'Obtained Value',
529 529
                 color: '#e70033',
530 530
                 dataLabels: {
@@ -544,7 +544,16 @@ $(function () {
544 544
                             is_array($undergrad_outcomes_attempted)
545 545
                             && array_key_exists($outcome->id, $undergrad_outcomes_attempted)
546 546
                             && $undergrad_outcomes_attempted[$outcome->id]!=0)
547
-                            {{{ ($undergrad_outcomes_achieved[$outcome->id]/$undergrad_outcomes_attempted[$outcome->id])*100 }}},
547
+                            <?php
548
+                            
549
+                            if (isset($undergrad_outcomes_achieved[$outcome->id]))
550
+                            $achieved = $undergrad_outcomes_achieved[$outcome->id];
551
+                            else {
552
+                                $achieved =0;
553
+                            }
554
+                            
555
+                            ?>
556
+                            {{{ ($achieved/$undergrad_outcomes_attempted[$outcome->id])*100 }}},
548 557
                         @else
549 558
                             0,
550 559
                         @endif
@@ -567,7 +576,7 @@ $(function () {
567 576
             xAxis: {
568 577
                 categories: [
569 578
                     @foreach($outcomes_grad as $outcome)
570
-                        "{{{ $outcome->name }}}",
579
+                        "{{{ $outcome->name }}} <br> (N = {{$grad_outcomes_attempted[$outcome->id]}} , {{$grad_outcomes_achieved[$outcome->id]}})",
571 580
                     @endforeach
572 581
                 ],
573 582
                 labels: {
@@ -654,7 +663,14 @@ $(function () {
654 663
                             is_array($grad_outcomes_attempted)
655 664
                             && array_key_exists($outcome->id, $grad_outcomes_attempted)
656 665
                             && $grad_outcomes_attempted[$outcome->id]!=0)
657
-                            {{{ ($grad_outcomes_achieved[$outcome->id]/$grad_outcomes_attempted[$outcome->id])*100 }}},
666
+                            <?php
667
+                             if (isset($grad_outcomes_achieved[$outcome->id]))
668
+                            $achieved = $grad_outcomes_achieved[$outcome->id];
669
+                            else {
670
+                                $achieved =0;
671
+                            }
672
+                            ?>
673
+                            {{{ ($achieved/$grad_outcomes_attempted[$outcome->id])*100 }}},
658 674
                         @else
659 675
                             0,
660 676
                         @endif
@@ -678,7 +694,7 @@ $(function () {
678 694
             xAxis: {
679 695
                 categories: [
680 696
                     @foreach($outcomes_undergrad as $outcome)
681
-                        "{{{ $outcome->name }}}",
697
+                        "{{{ $outcome->name }}} <br> (N = {{$undergrad_outcomes_attempted[$outcome->id]}} ,{{$undergrad_outcomes_achieved[$outcome->id]}})",
682 698
                     @endforeach
683 699
                 ],
684 700
                 labels: {
@@ -718,7 +734,7 @@ $(function () {
718 734
                 groupPadding: 0.075
719 735
                 },
720 736
             },
721
-            series: [{
737
+            series: [/*{
722 738
                 name: 'Expected Value',
723 739
                 color: '#555555',
724 740
                 dataLabels: {
@@ -745,7 +761,7 @@ $(function () {
745 761
                     @endforeach
746 762
                 ],
747 763
                 pointPadding: 0,
748
-            }, {
764
+            },*/ {
749 765
                 name: 'Obtained Value',
750 766
                 color: '#e70033',
751 767
                 dataLabels: {