Browse Source

Merge branch 'Merge_gabriel_mayo' of https://git.ccom.uprrp.edu/CDCC/OLAS into Merge_gabriel_mayo

verificar cambios
parent
commit
78aa1804c4

+ 1
- 1
app/config/app.php View File

@@ -15,7 +15,7 @@ return array(
15 15
 
16 16
 	//'debug' => $_ENV['APP_DEBUG'] ?: false,
17 17
 
18
-	'debug' => false,
18
+	'debug' => true,
19 19
 	/*
20 20
 	|--------------------------------------------------------------------------
21 21
 	| Application URL

+ 16
- 13
app/controllers/ActivitiesController.php View File

@@ -156,22 +156,25 @@ class ActivitiesController extends \BaseController
156 156
             ->select('programs.is_graduate')
157 157
             ->first();
158 158
         $outcomes = Outcome::active_by_semesters(array($course->semester), $level->is_graduate);
159
+        //$outcomes = $activity->getOutcomeReport();
159 160
 
160 161
         $assessment = DB::table('assessments')
161 162
             ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
162 163
             ->join('activities', 'activities.id', '=', 'activity_criterion.activity_id')
163 164
             ->where('activity_id', $activity->id)
164 165
             ->get();
165
-        if ($assessment) {
166
-            $outcomes_achieved = $activity->o_ach_array;
167
-            $outcomes_attempted = $activity->o_att_array;
168
-        } else {
169
-            $outcomes_achieved = [];
170
-            $outcomes_attempted = [];
171
-        }
166
+        //if ($assessment) {
167
+        //    $outcomes_achieved = $activity->o_ach_array;
168
+        //    $outcomes_attempted = $activity->o_att_array;
169
+        //} else {
170
+        //   $outcomes_achieved = [];
171
+        //   $outcomes_attempted = [];
172
+        //}
172 173
 
173
-        Log::info($outcomes_achieved);
174
-        Log::info($outcomes_achieved);
174
+        //Log::info($outcomes_achieved);
175
+        //Log::info($outcomes_achieved);
176
+
177
+        $outcomes_activity = $activity->getOutcomeReport();
175 178
 
176 179
 
177 180
 
@@ -188,7 +191,7 @@ class ActivitiesController extends \BaseController
188 191
             ->join('transformative_actions', 'transformative_activity_criterion.trans_action_id', '=', 'transformative_actions.id')
189 192
             ->where('activity_criterion.activity_id', $id)
190 193
             ->get();
191
-        return View::make('local.professors.activity', compact('activity', 'transformative_actions', 'activity_criterion', 'title', 'outcomes', 'outcomes_achieved', 'outcomes_attempted', 'course', 'student_count', 'active_semesters'));
194
+        return View::make('local.professors.activity', compact('activity', 'outcomes_activity', 'transformative_actions', 'activity_criterion', 'title', 'outcomes', 'outcomes_achieved', 'outcomes_attempted', 'course', 'student_count', 'active_semesters'));
192 195
     }
193 196
 
194 197
 
@@ -226,15 +229,15 @@ class ActivitiesController extends \BaseController
226 229
             ->addSelect('activity_criterion.activity_id', 'activity_criterion.weight', 'activity_criterion.id as activity_criterion_id')
227 230
             ->addSelect('rubric_criterion.rubric_id', 'rubric_criterion.id as rubric_criterion_id')
228 231
             ->get();
229
-$total_weights=0;
232
+        $total_weights = 0;
230 233
         foreach ($rubric_criterion as $index => $singleCR) {
231 234
             $singleCR->scales = json_encode(DB::table('scales')
232 235
                 ->join('criterion_scale', 'criterion_scale.scale_id', '=', 'scales.id')
233 236
                 ->where('criterion_scale.criterion_id', '=', $singleCR->criterion_id)
234 237
                 ->orderBy('position')
235 238
                 ->lists('description'));
236
-             $total_weights+=$singleCR->weight;
237
-       }
239
+            $total_weights += $singleCR->weight;
240
+        }
238 241
         $rubric_criterion_ids = DB::table('rubric_criterion')->where('rubric_id', '=', $rubric->id)->lists('id');
239 242
 
240 243
 

+ 5
- 5
app/controllers/AuthController.php View File

@@ -28,9 +28,9 @@ class AuthController extends \BaseController
28 28
 
29 29
 		if (!$validator->fails()) {
30 30
 			//			TODO: Remove this for production environment
31
-// 			if (App::environment('local', 'staging')) {
32
-// 				return $this->processLogin();
33
-// 			}
31
+			if (App::environment('local', 'staging')) {
32
+				return $this->processLogin();
33
+			}
34 34
 			try {
35 35
 				// User input
36 36
 				$username = str_replace('@upr.edu', '', Input::get('email'));
@@ -141,7 +141,7 @@ class AuthController extends \BaseController
141 141
 			}
142 142
 
143 143
 			// Redirect depending on user
144
-						return Redirect::intended('agreement');
144
+			return Redirect::intended('agreement');
145 145
 			switch (Auth::user()->role) {
146 146
 				case 1:
147 147
 					return Redirect::intended('administrator');
@@ -149,7 +149,7 @@ class AuthController extends \BaseController
149 149
 
150 150
 				case 2:
151 151
 					return Redirect::intended('school-coordinator');
152
-// 					return Redirect::intended('agreement');
152
+					// 					return Redirect::intended('agreement');
153 153
 					break;
154 154
 
155 155
 				case 3:

+ 4
- 3
app/controllers/CoursesController.php View File

@@ -17,6 +17,7 @@ CoursesController extends \BaseController
17 17
     {
18 18
 
19 19
         $course = Course::with('semester')->where('id', $id)->first();
20
+        Log::info($course->student_report_for_outcome);
20 21
         $title = $course->code . $course->number . '-' . $course->section . ' <span class="small attention">(' . $course->semester->code . ')</span>';
21 22
 
22 23
         // If course does not exist, display 404
@@ -60,11 +61,11 @@ CoursesController extends \BaseController
60 61
             case 1:
61 62
 
62 63
                 $programs = Program::with('school')->orderBy('name', 'asc')->get();
63
-                $professors = User::select(array('id', 'first_name', 'surnames'))->orderBy('surnames', 'asc')->orderBy('first_name', 'asc')->get();
64
+                $professors = User::select(array('users.id', 'first_name', 'surnames'))->orderBy('surnames', 'asc')->orderBy('first_name', 'asc')->get();
64 65
                 break;
65 66
             case 2:
66 67
                 $programs = Program::where("school_id", Auth::user()->school->id);
67
-                $professors = User::fromSchool(Auth::user()->school->id)->select(array('id', 'first_name', 'surnames'))->orderBy('surnames', 'asc')->orderBy('first_name', 'asc')->get();
68
+                $professors = User::fromSchool(Auth::user()->school->id)->select(array('users.id', 'first_name', 'surnames'))->orderBy('surnames', 'asc')->orderBy('first_name', 'asc')->get();
68 69
                 break;
69 70
             case 3:
70 71
                 $programs = Auth::user()->programs;
@@ -72,7 +73,7 @@ CoursesController extends \BaseController
72 73
                     ->where('program_user.user_id', Auth::user()->id)
73 74
                     ->lists('programs.id');
74 75
 
75
-                $professors = User::fromPrograms($program_ids)->select(array('id', 'first_name', 'surnames'))->orderBy('surnames', 'asc')->orderBy('first_name', 'asc')->get();
76
+                $professors = User::fromPrograms($program_ids)->select(array('users.id', 'first_name', 'surnames'))->orderBy('surnames', 'asc')->orderBy('first_name', 'asc')->get();
76 77
                 break;
77 78
         }
78 79
         //$users = User::select(array('id', 'first_name', 'surnames'))->orderBy('surnames', 'asc')->orderBy('first_name', 'asc')->get();

+ 73
- 10
app/controllers/Objective2Controller.php View File

@@ -771,7 +771,7 @@ class Objective2Controller extends \BaseController
771 771
 
772 772
 		/** Validation rules */
773 773
 		if ($clean_input['text'] == $Objective->text) {
774
-			$validator = $this->makeValidator($clean_input, false);
774
+			$validator = $this->makeValidator($clean_input, true);
775 775
 		} else
776 776
 			$validator = $this->makeValidator($clean_input, false);
777 777
 
@@ -825,41 +825,104 @@ class Objective2Controller extends \BaseController
825 825
 				//TODO
826 826
 
827 827
 				$objectiveId = $Objective->id;
828
+
829
+
830
+				//criteria_assoc, si le dan a 1, parea todos los criterios que esten pareado a este objetivo,
831
+				// a todos los criterios asociados de su programa
832
+
833
+				$criteria_assoc = DB::table('criterion_objective_outcome')
834
+					->join('program_criterion_objective_outcome as poco', 'poco.cri_obj_out_id', '=', 'criterion_objective_outcome.id')
835
+					//->join('program_criterion', 'program_criterion.criterion_id', '=', 'criterion_objective_outcome.criterion_id')
836
+					->whereIn('program_id', $clean_input['program_id'])
837
+					->where('objective_id', $objectiveId)
838
+					->groupBy('criterion_objective_outcome.criterion_id')
839
+					->select('criterion_objective_outcome.criterion_id')
840
+					->lists('criterion_objective_outcome.criterion_id');
828 841
 				//DB::delete("delete from `objective_outcome` where objective_id ={$objectiveId}");
829 842
 				DB::delete("delete from objective_program where objective_id = {$objectiveId}");
830 843
 
831 844
 				foreach ($clean_input['program_id'] as $program_id) {
832 845
 					DB::insert("insert into `objective_program`(objective_id, program_id) values ({$objectiveId},{$program_id})");
833 846
 				}
834
-				$criteria_assoc = DB::table('criterion_objective_outcome')
835
-					->join('program_criterion', 'program_criterion.criterion_id', '=', 'criterion_objective_outcome.criterion_id')
847
+
848
+				//borra todos los pareos de este objetivo de programas que no estan vinculados a este objetivo
849
+
850
+				$cri_obj_out_ids = DB::table('criterion_objective_outcome as cobo')
851
+					->where('objective_id', $objectiveId)
852
+					->lists('cobo.id');
853
+				DB::table("program_criterion_objective_outcome")
854
+					->whereIn('cri_obj_out_id', $cri_obj_out_ids)
855
+					->whereNotIn('program_id', $clean_input['program_id'])
856
+					->delete();
857
+
858
+				//el plan es, convertir todos los pareos de criterios-obj-out asociado a mi programa
859
+				//a holder primero
860
+
861
+				$cri_obj_out = DB::table('criterion_objective_outcome')
862
+					->join('program_criterion_objective_outcome as poco', 'poco.cri_obj_out_id', '=', 'criterion_objective_outcome.id')
836 863
 					->whereIn('program_id', $clean_input['program_id'])
837 864
 					->where('objective_id', $objectiveId)
838
-					->groupBy('program_criterion.criterion_id')
839
-					->select('program_criterion.criterion_id')
840
-					->lists('program_criterion.criterion_id');
865
+					->update(array(
866
+						'objective_id' => 0
867
+					));
868
+
869
+				//Luego por cada dominio que haya, chequea si existe ya el pareo
870
+				//si no existe insertalo.
871
+				//si insertaste, y pair_criteria == 1, parea todos los criterios bajo este programa con 
872
+				// ese dominio y outcome
873
+				// Luego por cada criterio que esta pareado a objetivo 0, en ese programa
874
+				//y en ese dominio, cambiale el objetivo a este. 
841 875
 
842
-				$criterion_array = [];
876
+
877
+
878
+				//los que se crearon nue
843 879
 				foreach ($clean_input['outcome_id'] as $outcome_id) {
844 880
 					$check_if_already_inserted = DB::table('objective_outcome')
845 881
 						->where('objective_id', $objectiveId)
846 882
 						->where('outcome_id', $outcome_id)
847 883
 						->first();
848
-
849 884
 					if (!isset($check_if_already_inserted)) {
850 885
 						DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
851 886
 						if ($clean_input['pair_criteria'] == '1') {
852 887
 							foreach ($criteria_assoc as $criterion_id) {
853 888
 
854
-								DB::table('criterion_objective_outcome')
855
-									->insert(array(
889
+								$cob_id = DB::table('criterion_objective_outcome')
890
+									->insertGetId(array(
856 891
 										"criterion_id" => $criterion_id,
857 892
 										"objective_id" => $objectiveId,
858 893
 										"outcome_id" => $outcome_id
859 894
 									));
895
+								foreach ($clean_input['program_id'] as $program_id)
896
+									DB::table('program_criterion_objective_outcome')
897
+										->insert(array(
898
+											'cri_obj_out_id' => $cob_id,
899
+											'program_id' => $program_id
900
+										));
860 901
 							}
861 902
 						}
862 903
 					}
904
+
905
+					//aqui estoy diciendo, todos los pareos bajo estos programas que tienen objetivo 0, y este dominio,
906
+					//unelo a este objetivo. 
907
+					DB::table('criterion_objective_outcome')
908
+						->join("program_criterion_objective_outcome", 'program_criterion_objective_outcome.cri_obj_out_id', '=', 'criterion_objective_outcome.id')
909
+						->whereIn('program_id', $clean_input['program_id'])
910
+						->where('objective_id', 0)
911
+						->where('outcome_id', $outcome_id)
912
+						->update(array(
913
+							'objective_id' => $objectiveId
914
+						));
915
+
916
+
917
+
918
+
919
+
920
+
921
+
922
+
923
+
924
+
925
+					$criterion_array = [];
863 926
 				}
864 927
 
865 928
 				DB::table('objective_outcome')

+ 31
- 7
app/controllers/ProfessorsController.php View File

@@ -13,7 +13,12 @@ class ProfessorsController extends \BaseController
13 13
     public function overview()
14 14
     {
15 15
         $title = 'My Courses';
16
-        $grouped_courses = Course::with('program')->where('user_id', Auth::user()->id)->whereIn('semester_id', Session::get('semesters_ids'))->groupBy(array('code', 'number', 'semester_id'))->get();
16
+        $grouped_courses = Course::with('program')
17
+            ->where('user_id', Auth::user()->id)
18
+            ->whereIn('semester_id', Session::get('semesters_ids'))
19
+            ->select("courses.*") //, 'programs.*')
20
+            ->addSelect(DB::raw("1 as grouped"))
21
+            ->groupBy(array('code', 'number', 'semester_id'))->get();
17 22
         $semesters = Session::get('semesters_ids');
18 23
         $semesters = DB::table('semesters')->whereIn('id', $semesters)->orderBy('start', 'ASC')->first();
19 24
         Log::info($semesters->start);
@@ -23,10 +28,10 @@ class ProfessorsController extends \BaseController
23 28
             ->orderBy('name', 'ASC')->get();
24 29
         $outcomeCount = count($outcomes);
25 30
 
26
-        Log::info($grouped_courses);
27
-        $grouped_outcomes_achieved_results = array();
28
-        $grouped_outcomes_attempted_results = array();
29
-        $grouped_sections = array();
31
+
32
+
33
+
34
+
30 35
 
31 36
         foreach ($grouped_courses as $index => $grouped_course) {
32 37
             // Blank outcomes for one course
@@ -111,7 +116,7 @@ class ProfessorsController extends \BaseController
111 116
 
112 117
         Log::info($program_courses);
113 118
 
114
-
119
+        /*
115 120
         foreach ($program_courses as $course) {
116 121
 
117 122
 
@@ -130,9 +135,28 @@ class ProfessorsController extends \BaseController
130 135
                     else $outcomes_attempted[$outcome] = $score;
131 136
                 }
132 137
             }
138
+        }*/
139
+
140
+        foreach ($program_courses as $course) {
141
+
142
+            $stu_ach = $course->student_report_for_outcome;
143
+
144
+
145
+            foreach ($stu_ach as $outcome => $outcome_score) {
146
+                if (array_key_exists($outcome, $outcomes_achieved))
147
+                    $outcomes_achieved[$outcome] += $outcome_score['calculations']['student_achieved'];
148
+                else $outcomes_achieved[$outcome] = $outcome_score['calculations']['student_achieved'];
149
+
150
+                if (array_key_exists($outcome, $outcomes_attempted))
151
+                    $outcomes_attempted[$outcome] += $outcome_score['calculations']['student_attempted'];
152
+                else $outcomes_attempted[$outcome] = $outcome_score['calculations']['student_attempted'];
153
+            }
133 154
         }
134 155
 
135 156
 
157
+
158
+
159
+
136 160
         // Program contact information
137 161
         $scoords = User::where('school_id', $program->school_id)
138 162
             ->where('role', 2)
@@ -169,4 +193,4 @@ class ProfessorsController extends \BaseController
169 193
 
170 194
         return View::make('local.managers.shared.general_studies_overview', compact('title', 'outcomes', 'schools', 'program_packs'));
171 195
     }
172
-}
196
+}

+ 49
- 12
app/controllers/ProgramCoordinatorsController.php View File

@@ -63,6 +63,7 @@ class ProgramCoordinatorsController extends \BaseController
63 63
       }
64 64
       */
65 65
 
66
+
66 67
     foreach ($programs as $program) {
67 68
       //Log::info($program);
68 69
       $program_array = array();
@@ -78,18 +79,52 @@ class ProgramCoordinatorsController extends \BaseController
78 79
       //Log::info($program_array);
79 80
 
80 81
       $program_array['program_courses'] = $program->courses;
81
-      //Log::info($program_array);
82
-      //Log::info('grouped_objectives, 1.variable, 2.array');
83 82
 
84
-      ////Log::info(array($program->objectives()));
85
-      // $program_array['grouped_objectives'] = $program->objectives();
83
+
84
+      $program_array['assessed_courses_count'] = 0;
85
+      foreach ($program->courses as $course) {
86
+
87
+        $student_report = $course->student_report_for_outcome;
88
+
89
+        if ($student_report) {
90
+
91
+          foreach ($student_report as $outcome_id => $score) {
92
+            if (array_key_exists($outcome_id, $program_array['outcomes_attempted']))  $program_array['outcomes_attempted'][$outcome_id] += $student_report[$outcome_id]['calculations']['student_attempted'];
93
+            else $program_array['outcomes_attempted'][$outcome_id] = $student_report[$outcome_id]['calculations']['student_attempted'];
94
+
95
+            if (array_key_exists($outcome_id, $program_array['outcomes_achieved']))  $program_array['outcomes_achieved'][$outcome_id] += $student_report[$outcome_id]['calculations']['student_achieved'];
96
+            else $program_array['outcomes_achieved'][$outcome_id] = $student_report[$outcome_id]['calculations']['student_achieved'];
97
+          }
98
+
99
+
100
+          $program_array['assessed_courses_count'] += 1;
101
+        }
102
+      }
103
+
104
+
105
+      /*foreach ($programs as $program) {
106
+      //Log::info($program);
107
+      $program_array = array();
108
+      $program_object = new \stdClass();
109
+      $program_object->name = $program->name;
110
+      $program_object->school = $program->school->name;
111
+      $program_object->id = $program->id;
112
+      $program_array['program'] = $program_object;
86 113
       //Log::info($program_array);
87
-      //Log::info("program_courses");
88
-      //Log::info($program_array['program_courses']);
114
+
115
+      $program_array['outcomes_achieved'] = [];
116
+      $program_array['outcomes_attempted'] = [];
89 117
       //Log::info($program_array);
90 118
 
119
+      $program_array['program_courses'] = $program->courses;
120
+
121
+
91 122
       $program_array['assessed_courses_count'] = 0;
123
+
124
+
92 125
       foreach ($program_array['program_courses'] as $course) {
126
+
127
+        //$student_report = $course->student_report_for_outcome;
93 128
         //Log::info($program_array);
94 129
 
95 130
         $program_array['course_outcomes_achieved'] = $course->outcomes_ach();
@@ -97,16 +132,17 @@ class ProgramCoordinatorsController extends \BaseController
97 132
         //Log::info("course_outcomes_achieved");
98 133
         //Log::info($program_array['course_outcomes_achieved']);
99 134
         //Log::info($program_array);
100
-        if (($program_array['course_outcomes_achieved'])) {
135
+        if ($program_array['course_outcomes_achieved']) {
136
+          //(($program_array['course_outcomes_achieved'])) {
101 137
           $program_array['course_outcomes_achieved'] = $course->outcomes_ach();
102 138
           $program_array['course_outcomes_attempted'] = $course->outcomes_att();
103 139
           //Log::info('course_outcomes_achieved');
104 140
           //Log::info($program_array['course_outcomes_achieved']);
105 141
           //Log::info($program_array);
106 142
 
107
-          foreach ($program_array['course_outcomes_achieved'] as $i => $score) {
108
-            if (array_key_exists($i, $program_array['outcomes_achieved']))  $program_array['outcomes_achieved'][$i] += $program_array['course_outcomes_achieved'][$i];
109
-            else $program_array['outcomes_achieved'][$i] = $program_array['course_outcomes_achieved'][$i];
143
+          foreach ($program_array['course_outcomes_achieved'] as $outcome_id => $score) {
144
+            if (array_key_exists($outcome_id, $program_array['outcomes_achieved']))  $program_array['outcomes_achieved'][$outcome_id] += $score;
145
+            else $program_array['outcomes_achieved'][$outcome_id] = $score;
110 146
             //Log::info('program["outcomes_achieved"]');
111 147
             //Log::info($program_array['outcomes_achieved'][$i]);
112 148
             //Log::info($program_array);
@@ -124,7 +160,8 @@ class ProgramCoordinatorsController extends \BaseController
124 160
 
125 161
           $program_array['assessed_courses_count'] += 1;
126 162
         }
127
-      }
163
+      }*/
164
+
128 165
 
129 166
       /**
130 167
        * List of grouped courses (grouped sections)
@@ -185,4 +222,4 @@ class ProgramCoordinatorsController extends \BaseController
185 222
 
186 223
     return View::make('local.managers.pCoords.overview', compact('title', 'programs', 'outcomes', 'programs_array', 'programs_contact'));
187 224
   }
188
-}
225
+}

+ 8
- 2
app/models/Activity.php View File

@@ -155,6 +155,10 @@ class Activity extends Eloquent
155 155
       ->distinct()
156 156
       ->get();
157 157
     $rubric = $this->rubric[0];
158
+    $outcomes_dict = [];
159
+    foreach ($outcomes as $outcome) {
160
+      $outcomes_dict[$outcome->id] = $outcome;
161
+    }
158 162
 
159 163
     /*
160 164
 
@@ -210,7 +214,7 @@ class Activity extends Eloquent
210 214
 
211 215
 
212 216
 
213
-    foreach ($outcomes as $outcome) {
217
+    foreach ($outcomes_dict as $outcome) {
214 218
       $ac_criteria = DB::table('criterion_objective_outcome as cobo')
215 219
         ->join('activity_criterion as ac', 'ac.criterion_id', '=', 'cobo.criterion_id')
216 220
         ->where("outcome_id", $outcome->id)
@@ -266,6 +270,8 @@ class Activity extends Eloquent
266 270
 
267 271
 
268 272
 
273
+
274
+
269 275
       /*foreach ($students_attempted as $student) {
270 276
         $student_criteria[$student];
271 277
       }
@@ -278,7 +284,7 @@ class Activity extends Eloquent
278 284
           ->get();
279 285
       }*/
280 286
     }
281
-    return $outcomes;
287
+    return $outcomes_dict;
282 288
   }
283 289
   // o_ach_array
284 290
   public function getOAchArrayAttribute($value)

+ 174
- 24
app/models/Course.php View File

@@ -479,14 +479,51 @@ class Course extends Eloquent
479 479
   {
480 480
     return $this->getStudentReportForOutcome($this);
481 481
   }
482
-  public static function getStudentReportForOutcome($course_code = null)
482
+  //user id is for groupped professor sections. so el query es  code, number, semester y user_id
483
+  public static function getStudentReportForOutcome($course_code = null, $user_id = null)
483 484
   {
484 485
     if ($course_code) {
485 486
       //Log::info('entré');
486
-      $criteria_id = DB::table('annual_plan_objective')
487
-        ->where('typ_semester_course_id', $course_code->typ_semester_course_id)
488
-        ->lists('criteria_id');
489
-      Log::info($criteria_id);
487
+
488
+      //Si entra aqui, significa que son los criterios dentro del annual plan, bajo un dominio en particular. 
489
+
490
+
491
+      if (isset($course_code->typ_semester_course_id)) {
492
+        $criteria_id = DB::table('annual_plan_objective')
493
+          ->where('typ_semester_course_id', $course_code->typ_semester_course_id)
494
+          ->lists('criteria_id');
495
+      }
496
+      //si entra aqui, estamos buscando del curso (o grupo de cursos independientes
497
+
498
+      else {
499
+        $criteria_id = DB::table('courses')
500
+          ->join('activities', 'courses.id', '=', 'activities.course_id')
501
+          ->join('activity_criterion', 'activities.id', '=', 'activity_criterion.activity_id');
502
+
503
+        //if this is 1, significa que son todos los cursos de ese semestre con nombre. 
504
+        if (isset($course_code->grouped)) {
505
+          $criteria_id = $criteria_id->where('courses.name', $course_code->name)
506
+            ->where('courses.code', $course_code->code)
507
+            ->where('courses.number', $course_code->number)
508
+            ->where('courses.semester_id', $course_code->semester_id);
509
+
510
+          //if user_id is set, this means its goruped courses of said professor.
511
+          if ($user_id) {
512
+            $criteria_id = $criteria_id->where('courses.user_id', $user_id);
513
+          }
514
+          $criteria_id = $criteria_id
515
+            ->groupBy('activity_criterion.criterion_id')
516
+            ->lists('activity_criterion.criterion_id');
517
+        }
518
+
519
+        //si es un solo curso. 
520
+        else {
521
+          $criteria_id = $criteria_id->where('courses.id', $course_code->id)
522
+            ->groupBy('activity_criterion.criterion_id')
523
+            ->lists('activity_criterion.criterion_id');
524
+        }
525
+      }
526
+      //Log::info($criteria_id);
490 527
       $program = Program::where('id', $course_code->program_id)->first();
491 528
       // // Log::info($program->code);
492 529
       if ($program->code == "") {
@@ -505,8 +542,11 @@ class Course extends Eloquent
505 542
       *
506 543
       *
507 544
       */
508
-      $table_per_student = DB::table('program_student_semester')
509
-        ->join('course_student', 'program_student_semester.student_id', '=', 'course_student.student_id')
545
+
546
+
547
+      $table_per_student = DB::table('course_student')
548
+
549
+        //->join('program_student_semester', 'program_student_semester.student_id', '=', 'course_student.student_id')
510 550
         ->join("students", 'course_student.student_id', '=', 'students.id')
511 551
         ->join('courses', 'courses.id', '=', 'course_student.course_id')
512 552
         ->join('activities', 'activities.course_id', '=', 'courses.id')
@@ -516,33 +556,143 @@ class Course extends Eloquent
516 556
         ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
517 557
 
518 558
         ->join('assessments', function ($join) {
519
-          $join->on("assessments.student_id", '=', 'program_student_semester.student_id')
559
+          $join->on("assessments.student_id", '=', 'course_student.student_id')
520 560
             ->on('assessments.activity_criterion_id', '=', 'activity_criterion.id');
521
-        })
522
-        ->where('courses.semester_id', $course_code->semester_id)
523
-        ->whereIn('courses.program_id', $program_ids)
524
-        ->where('courses.code', $course_code->code)
525
-        ->where('courses.number', $course_code->number)
526
-        ->whereIn('program_student_semester.program_id', $program_ids)
527
-        ->whereIn('activity_criterion.criterion_id', $criteria_id)
528
-        ->where('program_student_semester.semester_id', $course_code->semester_id)
561
+        });
562
+
563
+
564
+      // si typ_semester_course esta prendido, then significa que es de los estudiantes del programa
565
+      //
566
+
567
+      if (isset($course_code->typ_semester_course_id)) {
568
+        $table_per_student = $table_per_student->join('program_student_semester', 'program_student_semester.student_id', '=', 'course_student.student_id')
569
+          ->whereIn('program_student_semester.program_id', $program_ids)
570
+          ->where('program_student_semester.semester_id', $course_code->semester_id);
571
+      }
572
+      //si entra aqui, no especifica dominio, y hay que join todos los dominios
573
+      else {
574
+        $table_per_student = $table_per_student->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id');
575
+        //->join('program_criterion_objective_outcome', 'program_criterion_objective_outcome.cri_obj_out_id', '=', 'criterion_objective_outcome.id')
576
+        //->whereIn('program_criterion_objective_outcome.program_id', $program_ids);
577
+      }
578
+      //si estan grouped
579
+      if (isset($course_code->grouped)) {
580
+        $table_per_student = $table_per_student->where('courses.semester_id', $course_code->semester_id)
581
+          ->where('courses.code', $course_code->code)
582
+          ->where('courses.number', $course_code->number);
583
+      }
584
+      //si estan solo
585
+      else {
586
+        $table_per_student = $table_per_student->where('courses.id', $course_code->id);
587
+      }
588
+      ///// significa que depende
589
+      /////->where('courses.semester_id', $course_code->semester_id)
590
+      //->whereIn('courses.program_id', $program_ids)
591
+      /////->where('courses.code', $course_code->code)
592
+      /////->where('courses.number', $course_code->number)
593
+      //->whereIn('program_student_semester.program_id', $program_ids)
594
+      $table_per_student = $table_per_student->whereIn('activity_criterion.criterion_id', $criteria_id)
595
+        //->where('program_student_semester.semester_id', $course_code->semester_id)
529 596
         ->select('students.number as student_id')
530 597
         ->addSelect(DB::raw('count(assessments.activity_criterion_id) as criteria_attempted'))
531
-        ->addSelect(DB::raw('count(case when assessments.score>=rubrics.expected_points then 1 else NULL end) as criteria_achieved'))
532
-        ->groupBy('students.id');
598
+        ->addSelect(DB::raw('count(case when assessments.score>=rubrics.expected_points then 1 else NULL end) as criteria_achieved'));
599
+
600
+
601
+
602
+      //si entra aqui, significa que va agrupar los estudiantes para un solo dominio. 
603
+      if (isset($course_code->typ_semester_course_id)) {
604
+
605
+        $table_per_student = $table_per_student->groupBy('students.id');
606
+        $students = $table_per_student->get();
607
+      } else {
608
+        $table_per_student = $table_per_student->addSelect('outcome_id')
609
+          ->groupBy(array('students.id', 'outcome_id'));
610
+
611
+        Log::info($table_per_student->toSql());
612
+        Log::info($criteria_id);
613
+        Log::info("Amiga ponle a br");
614
+
615
+        $query = $table_per_student->get();
616
+
617
+
618
+
619
+        //Aqui queremos crear un arreglo que sea
620
+        /*
621
+          students = {
622
+            outcome_id: { 
623
+              'students':{
624
+              {student x,  crit_atttempted, crit_achieved},
625
+              {student x2, crit_attempted, crit_achieved},
626
+              ...
627
+              }
628
+              'calculation':{
629
+                student_achieved, student_attempted
630
+              }
631
+
632
+            }
633
+            outcome_id2:
634
+            { 
635
+              'students':{
636
+              {student x,  crit_atttempted, crit_achieved},
637
+              {student x2, crit_attempted, crit_achieved},
638
+              ...
639
+              }
640
+              'calculation':{
641
+                student_achieved, student_attempted
642
+              }
643
+            },
644
+          }
645
+          */
646
+
647
+        $students = [];
648
+
649
+        foreach ($query as $q) {
650
+
651
+          if (array_key_exists($q->outcome_id, $students)) {
652
+            $students[$q->outcome_id]['students'][] = $q;
653
+          } else {
654
+            $students[$q->outcome_id]['students'] = [];
655
+            $students[$q->outcome_id]['students'][] = $q;
656
+          }
657
+
658
+          $criteria_attempted = $q->criteria_attempted;
659
+          $criteria_achieved = $q->criteria_achieved;
660
+
661
+          //PREGUNTA??? ES 66.67??????
662
+
663
+          $achieved = 0;
664
+          if ($criteria_attempted != 0 && $criteria_achieved / $criteria_attempted * 100 >= 66.67) {
665
+            $achieved = 1;
666
+          }
667
+
668
+
669
+          if (isset($students[$q->outcome_id]['calculations']) && $criteria_attempted) {
670
+            $students[$q->outcome_id]['calculations']['student_attempted'] += 1;
671
+            $students[$q->outcome_id]['calculations']['student_achieved'] += $achieved;
672
+          } else if ($criteria_attempted) {
673
+            $students[$q->outcome_id]['calculations']['student_attempted'] = 1;
674
+            $students[$q->outcome_id]['calculations']['student_achieved'] = $achieved;
675
+          }
676
+        }
677
+      }
678
+
533 679
 
534 680
 
535 681
 
536 682
 
537 683
 
538 684
       //Log::info($criteria_id);
539
-      Log::info('los courseCode');
685
+      // Log::info('los courseCode');
540 686
       // Log::info(array($course_code));
541
-      Log::info('los programas');
542
-      Log::info($program_ids);
687
+      //Log::info('los programas');
688
+      //Log::info($program_ids);
689
+      //Log::info("crit");
690
+      //Log::info($criteria_id);
691
+
692
+      //Log::info($table_per_student->toSql());
693
+
694
+      //Log::info($students);
543 695
 
544
-      Log::info($table_per_student->toSql());
545
-      $students = $table_per_student->get();
546 696
 
547 697
 
548 698
       return $students;
@@ -617,7 +767,7 @@ class Course extends Eloquent
617 767
       $students_attempted = Criterion::students_attempted($criterion->id, $criterion->activity_id);
618 768
       $students_achieved = Criterion::students_achieved($criterion->id, $criterion->activity_id);
619 769
 
620
-      Log::info('estamos aqui');
770
+      //Log::info('estamos aqui');
621 771
       Log::info($students_attempted);
622 772
 
623 773
       if ($students_attempted) {

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

@@ -117,7 +117,7 @@ class Objective extends Eloquent
117 117
                 ->select('transformative_actions.*')
118 118
                 ->get();
119 119
             $course_code->future_typ_course_id = Course::getFutureTypSemesterCourses($course_code->typ_semester_course_id, $course_code->program_id);
120
-
120
+            $course_code->grouped = 1;
121 121
 
122 122
             $course_code->students = Course::getStudentReportForOutcome($course_code);
123 123
             //Log::info(array($course_code));

+ 2
- 2
app/models/Outcome.php View File

@@ -69,8 +69,8 @@ class Outcome extends Eloquent
69 69
 		$whole_dict = [];
70 70
 		foreach ($this->annual_objectives as $objective) {
71 71
 			foreach ($objective->grouped_annual_course as $course_code) {
72
-				Log::info("Existen los cursos");
73
-				Log::info(json_encode($course_code));
72
+
73
+				$course_code->grouped = 1;
74 74
 				foreach ($course_code->student_report_for_outcome as $student) {
75 75
 
76 76
 					//If is not defined, define

+ 1
- 1
app/views/global/view-objectives-criteria.blade.php View File

@@ -523,7 +523,7 @@
523 523
                         select.find('div.remove-btn').hide()
524 524
                         prog_div.append(select);
525 525
                         $('select.criteria_select').selectpicker('refresh');
526
-                        if(selected_options){
526
+                        if(selected_options.length>0){
527 527
                             $.each(selected_options, function(ind, cri){
528 528
 
529 529
                                 the_picker = select.find('select.criteria_select').first();

+ 32
- 10
app/views/local/managers/pCoords/overview.blade.php View File

@@ -278,8 +278,18 @@
278 278
             xAxis: {
279 279
                 categories: [
280 280
                     @foreach($outcomes as $outcome)
281
-                        "{{{ $outcome->name }}}",
282
-                    @endforeach
281
+                        @if(is_array($program_item['outcomes_attempted'])
282
+                        && array_key_exists($outcome->id, $program_item['outcomes_attempted'])
283
+                        && array_key_exists($outcome->id, $program_item['outcomes_achieved'])
284
+                        && $program_item['outcomes_attempted'][$outcome->id]!=0)
285
+
286
+                        "{{{ $outcome->name }}}<br> (N = {{$program_item['outcomes_attempted'][$outcome->id]}}, {{$program_item['outcomes_achieved'][$outcome->id]}})",
287
+                    @else
288
+                        "{{$outcome->name}}<br> (N = 0, 0)",
289
+
290
+                        @endif
291
+                    
292
+                        @endforeach
283 293
                 ],
284 294
                 labels: {
285 295
                     style: {
@@ -296,8 +306,23 @@
296 306
                 min: 0,
297 307
                 max: 100,
298 308
                 title: {
299
-                    text: 'Percentage'
300
-                }
309
+                text: 'Percentage'
310
+                }, 
311
+                
312
+                        plotLines:[{
313
+                    value:66.67,
314
+                    color: '#000',
315
+                    width:3,
316
+                    zIndex:4,
317
+                    label:{
318
+                        text: 'Goal (66.67%)',
319
+                        style: {
320
+                            color: '#000',
321
+                            fontSize: '14px',
322
+                        }
323
+            
324
+                    }
325
+                }]
301 326
             },
302 327
             tooltip: {
303 328
                 headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
@@ -318,7 +343,7 @@
318 343
                 groupPadding: 0.075
319 344
                 },
320 345
             },
321
-            series: [{
346
+            series: [{{--{
322 347
                 name: 'Expected Value',
323 348
                 color: '#555555',
324 349
                 dataLabels: {
@@ -332,11 +357,8 @@
332 357
                     },
333 358
                     y:-1
334 359
                 }, 
335
-                <?php
336
-                Log::info('program_item');
337
-                Log::info($program_item);
338 360
 
339
-                ?>
361
+            
340 362
                 data: [
341 363
                     @foreach($outcomes as $index => $outcome)
342 364
                         @if(
@@ -350,7 +372,7 @@
350 372
                     @endforeach
351 373
                 ]
352 374
 
353
-            },{
375
+            },--}}{
354 376
                 name: 'Obtained Value',
355 377
                 color: '#e70033',
356 378
                 dataLabels: {

+ 10
- 5
app/views/local/managers/shared/objectives.blade.php View File

@@ -410,10 +410,13 @@
410 410
                     // Select associated outcome
411 411
                     $(".removable-outcome").remove();
412 412
                     $('.warning-objective').remove();
413
+                    $("#assoc_outcome0").attr('data-old-outcome-id',json.outcome[0].outcome_id);
413 414
                     $('#assoc_outcome0').val(json.outcome[0].outcome_id);
414 415
 
415 416
                     disabled = 0;
416
-                    if (json.outcome[0].typ_semester_outcome_id != null || json.outcome[0].count_criterion_id != 0) {
417
+
418
+                    //se va a disable cuando pertenece a un plan. 
419
+                    if (json.outcome[0].typ_semester_outcome_id != null){ //|| json.outcome[0].count_criterion_id != 0) {
417 420
                         $('#assoc_outcome0').attr('disabled', true);
418 421
                         disabled = 1;
419 422
                     } else $('#assoc_outcome0').attr('disabled', false);
@@ -426,6 +429,7 @@
426 429
                             'name': "assoc_outcome[]",
427 430
                             'data-live-search': 'true',
428 431
                             'id': 'assoc_outcome' + i.toString(),
432
+                            'data-old-outcome-id': json.outcome[i].outcome_id
429 433
 
430 434
 
431 435
                         });
@@ -448,8 +452,8 @@
448 452
 
449 453
                         $div.appendTo('#assocOutcomeGroup')
450 454
                         $select.append(selectOptions);
451
-                        if (json.outcome[i].typ_semester_outcome_id != null || json.outcome[i].count_criterion_id !=
452
-                            0) {
455
+                        if (json.outcome[i].typ_semester_outcome_id != null //|| json.outcome[i].count_criterion_id != 0
456
+                            ) {
453 457
                             $select.attr('disabled', true);
454 458
                             $button.attr('disabled', true);
455 459
                             disabled = 1;
@@ -480,7 +484,7 @@
480 484
                         }).html('<span aria-hidden="true">×</span>');
481 485
                         alert.append(button);
482 486
                         alert.append(
483
-                            '<strong>If you wish to edit the disabled Learning Outcomes you need to detach the Objective from every Criteria paired to it and this Objectvie cannot be in any annual plan with that Learning Outcome</strong>'
487
+                            '<strong>If you wish to edit the disabled Learning Outcomes, you need to detach this Objective from the desired Learning Outcome in every Three Year Plan.</strong>'
484 488
                         )
485 489
 
486 490
                         alert.appendTo($('#message_to_disconnect'))
@@ -650,7 +654,7 @@
650 654
             e.preventDefault();
651 655
             newOutcomes = [];
652 656
             $('#assocOutcomeGroup').find('select').each(function() {
653
-                if ($(this).data('new-outcome') == true) {
657
+                if ($(this).data('new-outcome') == true || $(this).data('old-outcome-id') != $(this).val()) {
654 658
                     option = $(this).find(':selected');
655 659
                     newOutcomes.push(option[0].text);
656 660
                 }
@@ -676,6 +680,7 @@
676 680
         })
677 681
         //Terrible notation but
678 682
 
683
+
679 684
         pair_every_criteria_with_objective = 0;
680 685
         $('#update_button').on('click', function(e) {
681 686
             e.preventDefault();

+ 6
- 1
app/views/local/managers/shared/rubrics.blade.php View File

@@ -1342,6 +1342,8 @@ $('.save').on('click', function(e)
1342 1342
     {
1343 1343
             $('#js-error-row').hide();
1344 1344
     }
1345
+
1346
+    /*
1345 1347
     program_id = $('#select-program').find(':selected').data('program-id')
1346 1348
     if(program_id == 0){
1347 1349
         $('#modal-title-rubric').html("All criteria will be associated with this school's programs");
@@ -1408,10 +1410,13 @@ $('.save').on('click', function(e)
1408 1410
         });
1409 1411
     }
1410 1412
     
1411
-    $('#rubric-modal').modal('toggle');
1413
+    $('#rubric-modal').modal('toggle');*/
1412 1414
     $('#saveButton').data('button-id',$(this).attr('id'));
1413 1415
 
1414 1416
 
1417
+    saveTemplate()
1418
+
1419
+
1415 1420
 });
1416 1421
 
1417 1422
 // When the confirm  delete button is clicked

+ 4
- 2
app/views/local/managers/shared/rubrics_new.blade.php View File

@@ -1084,7 +1084,7 @@ console.log($('#select-school'));
1084 1084
             {{ Auth::user()->role }}==1
1085 1085
             || ({{ Auth::user()->role }}==2 && selected.data('admin')!=1)
1086 1086
             || ({{ Auth::user()->role }}==3
1087
-                && programs.includes(selected.data('template-program-id').toString())
1087
+                && programs.includes(selected.data('template-program-id'))
1088 1088
 
1089 1089
                 && selected.data('admin')!=1
1090 1090
             )
@@ -1393,6 +1393,7 @@ $('.save').on('click', function(e)
1393 1393
     {
1394 1394
             $('#js-error-row').hide();
1395 1395
     }
1396
+    /*
1396 1397
     program_id = $('#select-program').find(':selected').data('program-id')
1397 1398
     if(program_id == 0){
1398 1399
         $('#modal-title-rubric').html("All criteria will be associated with this school's programs");
@@ -1477,10 +1478,11 @@ $('.save').on('click', function(e)
1477 1478
         });
1478 1479
     }
1479 1480
     
1480
-    $('#rubric-modal').modal('toggle');
1481
+    $('#rubric-modal').modal('toggle');*/
1481 1482
     $('#saveButton').data('button-id',$(this).attr('id'));
1482 1483
 
1483 1484
 
1485
+    saveTemplate();
1484 1486
 });
1485 1487
 
1486 1488
 // When the confirm  delete button is clicked

+ 15
- 8
app/views/local/professors/activity.blade.php View File

@@ -499,14 +499,17 @@
499 499
     text: 'Performance by Learning Outcome Criteria in {{ $title }}'
500 500
     },
501 501
     xAxis: {
502
-    categories: [
502
+    categories: [ 
503 503
     @foreach ($outcomes as $outcome)
504
-        @if(is_array($outcomes_attempted) &&
505
-        array_key_exists($outcome->id, $outcomes_attempted) &&
506
-        $outcomes_attempted[$outcome->id] != 0)
504
+        @if( array_key_exists($outcome->id, $outcomes_activity) &&
505
+        $outcomes_activity[$outcome->id]  //&&
506
+        //array_key_exists($outcome->id, $outcomes_attempted) &&
507
+        //$outcomes_attempted[$outcome->id] != 0
508
+        )
509
+        
507 510
             <?php
508
-            $attempted = $outcomes_attempted[$outcome->id];
509
-            $achieved = $outcomes_achieved[$outcome->id];
511
+            $attempted = $outcomes_activity[$outcome->id]->attempted;
512
+            $achieved = $outcomes_activity[$outcome->id]->achieved;
510 513
             ?>
511 514
 
512 515
         @else
@@ -587,8 +590,12 @@
587 590
     },
588 591
     data:[
589 592
     @foreach ($outcomes as $index => $outcome)
590
-        @if (is_array($outcomes_attempted) && array_key_exists($outcome->id, $outcomes_attempted) && $outcomes_attempted[$outcome->id] != 0)
591
-            {{ ($outcomes_achieved[$outcome->id] / $outcomes_attempted[$outcome->id]) * 100 }},
593
+        @if( array_key_exists($outcome->id, $outcomes_activity) &&
594
+        $outcomes_activity[$outcome->id])
595
+            {{$outcomes_activity[$outcome->id]->achieved / $outcomes_activity[$outcome->id]->attempted * 100}}
596
+            {{-- ($outcomes_achieved[$outcome->id] / $outcomes_attempted[$outcome->id]) * 100 --}},
597
+        {{--@if (is_array($outcomes_attempted) && array_key_exists($outcome->id, $outcomes_attempted) && $outcomes_attempted[$outcome->id] != 0) --}}
598
+        {{--    {{ ($outcomes_achieved[$outcome->id] / $outcomes_attempted[$outcome->id]) * 100 }}, --}}
592 599
         @else
593 600
             0,
594 601
         @endif

+ 17
- 11
app/views/local/professors/course.blade.php View File

@@ -248,6 +248,10 @@
248 248
 @stop
249 249
 
250 250
 @section('javascript')
251
+
252
+<?php
253
+$student_ach = $course->student_report_for_outcome;
254
+?>
251 255
 $(function () {
252 256
     $('#graph').highcharts({
253 257
         chart: {
@@ -261,14 +265,14 @@ $(function () {
261 265
                 @foreach($outcomes as $outcome)
262 266
 
263 267
                 @if(
264
-                        is_array($outcomes_attempted)
265
-                        && array_key_exists($outcome->id, $outcomes_attempted)
266
-                        && $outcomes_attempted[$outcome->id]!=0)
268
+                        is_array($student_ach)
269
+                        && array_key_exists($outcome->id, $student_ach)
270
+                        && $student_ach[$outcome->id]['calculations']['student_attempted']!=0)
267 271
                     <?php
268
-                        $attempted = $outcomes_attempted[$outcome->id];
272
+                        $attempted = $student_ach[$outcome->id]['calculations']['student_attempted'];
269 273
                         
270
-                        if( isset($outcomes_achieved[$outcome->id]))
271
-                            $achieved =$outcomes_achieved[$outcome->id];
274
+                        if( isset($student_ach[$outcome->id]['calculations']['student_achieved']))
275
+                            $achieved =$student_ach[$outcome->id]['calculations']['student_achieved'];
272 276
 
273 277
                         else $achieved = 0;
274 278
                     ?>
@@ -358,11 +362,13 @@ $(function () {
358 362
             data:[
359 363
                 @foreach($outcomes as $index => $outcome)
360 364
                     @if(
361
-                        is_array($outcomes_attempted)
362
-                        && array_key_exists($outcome->id, $outcomes_attempted)
363
-                        && array_key_exists($outcome->id, $outcomes_achieved)
364
-                        && $outcomes_attempted[$outcome->id]!=0)
365
-                        {{{ ($outcomes_achieved[$outcome->id]/$outcomes_attempted[$outcome->id])*100 }}},
365
+                        is_array($student_ach)
366
+                        && array_key_exists($outcome->id, $student_ach)
367
+                        && $student_ach[$outcome->id]['calculations']['student_attempted']!=0
368
+                        && $student_ach[$outcome->id]['calculations']['student_achieved'])
369
+
370
+
371
+                        {{{ ($student_ach[$outcome->id]['calculations']['student_achieved']/$student_ach[$outcome->id]['calculations']['student_attempted'])*100 }}},
366 372
                     @else
367 373
                         0,
368 374
                     @endif

+ 17
- 10
app/views/local/professors/overview.blade.php View File

@@ -106,6 +106,12 @@ loadGraphs();
106 106
 function loadGraphs() {
107 107
 
108 108
     @foreach($grouped_courses as $index=>$grouped_course)
109
+
110
+        <?php
111
+
112
+            $student_in_course = $grouped_course->getStudentReportForOutcome($grouped_course, Auth::user()->id);
113
+            Log::info($student_in_course);
114
+        ?>
109 115
         // Load grad charts after clicking tab, so they are sized correctly.  
110 116
         $('#graph-{{ $index }}').highcharts({
111 117
             chart: {
@@ -120,14 +126,14 @@ function loadGraphs() {
120 126
                     	@if($outcome->level==3 || ($grouped_course->program->is_graduate==0 && $outcome->level==1))
121 127
 
122 128
                             @if(
123
-                                is_array($grouped_outcomes_attempted_results[$index])
124
-                                && array_key_exists($outcome->id, $grouped_outcomes_attempted_results[$index])
125
-                                && $grouped_outcomes_attempted_results[$index][$outcome->id]!=0)
129
+                                is_array($student_in_course)
130
+                                && array_key_exists($outcome->id, $student_in_course)
131
+                                && $student_in_course[$outcome->id]['calculations']['student_attempted']!=0)
126 132
                                 <?php
127
-                                    $attempted = $grouped_outcomes_attempted_results[$index][$outcome->id];
133
+                                    $attempted = $student_in_course[$outcome->id]['calculations']['student_attempted'];
128 134
                                     
129
-                                    if( isset($grouped_outcomes_achieved_results[$index][$outcome->id]))
130
-                                        $achieved =$grouped_outcomes_achieved_results[$index][$outcome->id];
135
+                                    if( isset($student_in_course[$outcome->id]['calculations']['student_achieved']))
136
+                                        $achieved =$student_in_course[$outcome->id]['calculations']['student_achieved'];
131 137
 
132 138
                                     else $achieved = 0;
133 139
                                 ?>
@@ -234,10 +240,11 @@ function loadGraphs() {
234 240
                     ?>
235 241
 					@if($outcome->level==3 || ($grouped_course->program->is_graduate==0 && $outcome->level==1))
236 242
                         @if(
237
-                            is_array($grouped_outcomes_attempted_results[$index])
238
-                            && array_key_exists($outcome->id, $grouped_outcomes_attempted_results[$index])
239
-                            && $grouped_outcomes_attempted_results[$index][$outcome->id]!=0)
240
-                            {{{ ($grouped_outcomes_achieved_results[$index][$outcome->id]/$grouped_outcomes_attempted_results[$index][$outcome->id])*100 }}},
243
+                                is_array($student_in_course)
244
+                                && array_key_exists($outcome->id, $student_in_course)
245
+                                && $student_in_course[$outcome->id]['calculations']['student_attempted']!=0)
246
+                               
247
+                            {{{ ($student_in_course[$outcome->id]['calculations']['student_achieved']/$student_in_course[$outcome->id]['calculations']['student_attempted'])*100 }}},
241 248
                         @else
242 249
                             0,
243 250
                         @endif