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
 
15
 
16
 	//'debug' => $_ENV['APP_DEBUG'] ?: false,
16
 	//'debug' => $_ENV['APP_DEBUG'] ?: false,
17
 
17
 
18
-	'debug' => false,
18
+	'debug' => true,
19
 	/*
19
 	/*
20
 	|--------------------------------------------------------------------------
20
 	|--------------------------------------------------------------------------
21
 	| Application URL
21
 	| Application URL

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

156
             ->select('programs.is_graduate')
156
             ->select('programs.is_graduate')
157
             ->first();
157
             ->first();
158
         $outcomes = Outcome::active_by_semesters(array($course->semester), $level->is_graduate);
158
         $outcomes = Outcome::active_by_semesters(array($course->semester), $level->is_graduate);
159
+        //$outcomes = $activity->getOutcomeReport();
159
 
160
 
160
         $assessment = DB::table('assessments')
161
         $assessment = DB::table('assessments')
161
             ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
162
             ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
162
             ->join('activities', 'activities.id', '=', 'activity_criterion.activity_id')
163
             ->join('activities', 'activities.id', '=', 'activity_criterion.activity_id')
163
             ->where('activity_id', $activity->id)
164
             ->where('activity_id', $activity->id)
164
             ->get();
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
             ->join('transformative_actions', 'transformative_activity_criterion.trans_action_id', '=', 'transformative_actions.id')
191
             ->join('transformative_actions', 'transformative_activity_criterion.trans_action_id', '=', 'transformative_actions.id')
189
             ->where('activity_criterion.activity_id', $id)
192
             ->where('activity_criterion.activity_id', $id)
190
             ->get();
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
             ->addSelect('activity_criterion.activity_id', 'activity_criterion.weight', 'activity_criterion.id as activity_criterion_id')
229
             ->addSelect('activity_criterion.activity_id', 'activity_criterion.weight', 'activity_criterion.id as activity_criterion_id')
227
             ->addSelect('rubric_criterion.rubric_id', 'rubric_criterion.id as rubric_criterion_id')
230
             ->addSelect('rubric_criterion.rubric_id', 'rubric_criterion.id as rubric_criterion_id')
228
             ->get();
231
             ->get();
229
-$total_weights=0;
232
+        $total_weights = 0;
230
         foreach ($rubric_criterion as $index => $singleCR) {
233
         foreach ($rubric_criterion as $index => $singleCR) {
231
             $singleCR->scales = json_encode(DB::table('scales')
234
             $singleCR->scales = json_encode(DB::table('scales')
232
                 ->join('criterion_scale', 'criterion_scale.scale_id', '=', 'scales.id')
235
                 ->join('criterion_scale', 'criterion_scale.scale_id', '=', 'scales.id')
233
                 ->where('criterion_scale.criterion_id', '=', $singleCR->criterion_id)
236
                 ->where('criterion_scale.criterion_id', '=', $singleCR->criterion_id)
234
                 ->orderBy('position')
237
                 ->orderBy('position')
235
                 ->lists('description'));
238
                 ->lists('description'));
236
-             $total_weights+=$singleCR->weight;
237
-       }
239
+            $total_weights += $singleCR->weight;
240
+        }
238
         $rubric_criterion_ids = DB::table('rubric_criterion')->where('rubric_id', '=', $rubric->id)->lists('id');
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
 
28
 
29
 		if (!$validator->fails()) {
29
 		if (!$validator->fails()) {
30
 			//			TODO: Remove this for production environment
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
 			try {
34
 			try {
35
 				// User input
35
 				// User input
36
 				$username = str_replace('@upr.edu', '', Input::get('email'));
36
 				$username = str_replace('@upr.edu', '', Input::get('email'));
141
 			}
141
 			}
142
 
142
 
143
 			// Redirect depending on user
143
 			// Redirect depending on user
144
-						return Redirect::intended('agreement');
144
+			return Redirect::intended('agreement');
145
 			switch (Auth::user()->role) {
145
 			switch (Auth::user()->role) {
146
 				case 1:
146
 				case 1:
147
 					return Redirect::intended('administrator');
147
 					return Redirect::intended('administrator');
149
 
149
 
150
 				case 2:
150
 				case 2:
151
 					return Redirect::intended('school-coordinator');
151
 					return Redirect::intended('school-coordinator');
152
-// 					return Redirect::intended('agreement');
152
+					// 					return Redirect::intended('agreement');
153
 					break;
153
 					break;
154
 
154
 
155
 				case 3:
155
 				case 3:

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

17
     {
17
     {
18
 
18
 
19
         $course = Course::with('semester')->where('id', $id)->first();
19
         $course = Course::with('semester')->where('id', $id)->first();
20
+        Log::info($course->student_report_for_outcome);
20
         $title = $course->code . $course->number . '-' . $course->section . ' <span class="small attention">(' . $course->semester->code . ')</span>';
21
         $title = $course->code . $course->number . '-' . $course->section . ' <span class="small attention">(' . $course->semester->code . ')</span>';
21
 
22
 
22
         // If course does not exist, display 404
23
         // If course does not exist, display 404
60
             case 1:
61
             case 1:
61
 
62
 
62
                 $programs = Program::with('school')->orderBy('name', 'asc')->get();
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
                 break;
65
                 break;
65
             case 2:
66
             case 2:
66
                 $programs = Program::where("school_id", Auth::user()->school->id);
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
                 break;
69
                 break;
69
             case 3:
70
             case 3:
70
                 $programs = Auth::user()->programs;
71
                 $programs = Auth::user()->programs;
72
                     ->where('program_user.user_id', Auth::user()->id)
73
                     ->where('program_user.user_id', Auth::user()->id)
73
                     ->lists('programs.id');
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
                 break;
77
                 break;
77
         }
78
         }
78
         //$users = User::select(array('id', 'first_name', 'surnames'))->orderBy('surnames', 'asc')->orderBy('first_name', 'asc')->get();
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
 
771
 
772
 		/** Validation rules */
772
 		/** Validation rules */
773
 		if ($clean_input['text'] == $Objective->text) {
773
 		if ($clean_input['text'] == $Objective->text) {
774
-			$validator = $this->makeValidator($clean_input, false);
774
+			$validator = $this->makeValidator($clean_input, true);
775
 		} else
775
 		} else
776
 			$validator = $this->makeValidator($clean_input, false);
776
 			$validator = $this->makeValidator($clean_input, false);
777
 
777
 
825
 				//TODO
825
 				//TODO
826
 
826
 
827
 				$objectiveId = $Objective->id;
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
 				//DB::delete("delete from `objective_outcome` where objective_id ={$objectiveId}");
841
 				//DB::delete("delete from `objective_outcome` where objective_id ={$objectiveId}");
829
 				DB::delete("delete from objective_program where objective_id = {$objectiveId}");
842
 				DB::delete("delete from objective_program where objective_id = {$objectiveId}");
830
 
843
 
831
 				foreach ($clean_input['program_id'] as $program_id) {
844
 				foreach ($clean_input['program_id'] as $program_id) {
832
 					DB::insert("insert into `objective_program`(objective_id, program_id) values ({$objectiveId},{$program_id})");
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
 					->whereIn('program_id', $clean_input['program_id'])
863
 					->whereIn('program_id', $clean_input['program_id'])
837
 					->where('objective_id', $objectiveId)
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
 				foreach ($clean_input['outcome_id'] as $outcome_id) {
879
 				foreach ($clean_input['outcome_id'] as $outcome_id) {
844
 					$check_if_already_inserted = DB::table('objective_outcome')
880
 					$check_if_already_inserted = DB::table('objective_outcome')
845
 						->where('objective_id', $objectiveId)
881
 						->where('objective_id', $objectiveId)
846
 						->where('outcome_id', $outcome_id)
882
 						->where('outcome_id', $outcome_id)
847
 						->first();
883
 						->first();
848
-
849
 					if (!isset($check_if_already_inserted)) {
884
 					if (!isset($check_if_already_inserted)) {
850
 						DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
885
 						DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
851
 						if ($clean_input['pair_criteria'] == '1') {
886
 						if ($clean_input['pair_criteria'] == '1') {
852
 							foreach ($criteria_assoc as $criterion_id) {
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
 										"criterion_id" => $criterion_id,
891
 										"criterion_id" => $criterion_id,
857
 										"objective_id" => $objectiveId,
892
 										"objective_id" => $objectiveId,
858
 										"outcome_id" => $outcome_id
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
 				DB::table('objective_outcome')
928
 				DB::table('objective_outcome')

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

13
     public function overview()
13
     public function overview()
14
     {
14
     {
15
         $title = 'My Courses';
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
         $semesters = Session::get('semesters_ids');
22
         $semesters = Session::get('semesters_ids');
18
         $semesters = DB::table('semesters')->whereIn('id', $semesters)->orderBy('start', 'ASC')->first();
23
         $semesters = DB::table('semesters')->whereIn('id', $semesters)->orderBy('start', 'ASC')->first();
19
         Log::info($semesters->start);
24
         Log::info($semesters->start);
23
             ->orderBy('name', 'ASC')->get();
28
             ->orderBy('name', 'ASC')->get();
24
         $outcomeCount = count($outcomes);
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
         foreach ($grouped_courses as $index => $grouped_course) {
36
         foreach ($grouped_courses as $index => $grouped_course) {
32
             // Blank outcomes for one course
37
             // Blank outcomes for one course
111
 
116
 
112
         Log::info($program_courses);
117
         Log::info($program_courses);
113
 
118
 
114
-
119
+        /*
115
         foreach ($program_courses as $course) {
120
         foreach ($program_courses as $course) {
116
 
121
 
117
 
122
 
130
                     else $outcomes_attempted[$outcome] = $score;
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
         // Program contact information
160
         // Program contact information
137
         $scoords = User::where('school_id', $program->school_id)
161
         $scoords = User::where('school_id', $program->school_id)
138
             ->where('role', 2)
162
             ->where('role', 2)
169
 
193
 
170
         return View::make('local.managers.shared.general_studies_overview', compact('title', 'outcomes', 'schools', 'program_packs'));
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
       }
63
       }
64
       */
64
       */
65
 
65
 
66
+
66
     foreach ($programs as $program) {
67
     foreach ($programs as $program) {
67
       //Log::info($program);
68
       //Log::info($program);
68
       $program_array = array();
69
       $program_array = array();
78
       //Log::info($program_array);
79
       //Log::info($program_array);
79
 
80
 
80
       $program_array['program_courses'] = $program->courses;
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
       //Log::info($program_array);
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
       //Log::info($program_array);
117
       //Log::info($program_array);
90
 
118
 
119
+      $program_array['program_courses'] = $program->courses;
120
+
121
+
91
       $program_array['assessed_courses_count'] = 0;
122
       $program_array['assessed_courses_count'] = 0;
123
+
124
+
92
       foreach ($program_array['program_courses'] as $course) {
125
       foreach ($program_array['program_courses'] as $course) {
126
+
127
+        //$student_report = $course->student_report_for_outcome;
93
         //Log::info($program_array);
128
         //Log::info($program_array);
94
 
129
 
95
         $program_array['course_outcomes_achieved'] = $course->outcomes_ach();
130
         $program_array['course_outcomes_achieved'] = $course->outcomes_ach();
97
         //Log::info("course_outcomes_achieved");
132
         //Log::info("course_outcomes_achieved");
98
         //Log::info($program_array['course_outcomes_achieved']);
133
         //Log::info($program_array['course_outcomes_achieved']);
99
         //Log::info($program_array);
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
           $program_array['course_outcomes_achieved'] = $course->outcomes_ach();
137
           $program_array['course_outcomes_achieved'] = $course->outcomes_ach();
102
           $program_array['course_outcomes_attempted'] = $course->outcomes_att();
138
           $program_array['course_outcomes_attempted'] = $course->outcomes_att();
103
           //Log::info('course_outcomes_achieved');
139
           //Log::info('course_outcomes_achieved');
104
           //Log::info($program_array['course_outcomes_achieved']);
140
           //Log::info($program_array['course_outcomes_achieved']);
105
           //Log::info($program_array);
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
             //Log::info('program["outcomes_achieved"]');
146
             //Log::info('program["outcomes_achieved"]');
111
             //Log::info($program_array['outcomes_achieved'][$i]);
147
             //Log::info($program_array['outcomes_achieved'][$i]);
112
             //Log::info($program_array);
148
             //Log::info($program_array);
124
 
160
 
125
           $program_array['assessed_courses_count'] += 1;
161
           $program_array['assessed_courses_count'] += 1;
126
         }
162
         }
127
-      }
163
+      }*/
164
+
128
 
165
 
129
       /**
166
       /**
130
        * List of grouped courses (grouped sections)
167
        * List of grouped courses (grouped sections)
185
 
222
 
186
     return View::make('local.managers.pCoords.overview', compact('title', 'programs', 'outcomes', 'programs_array', 'programs_contact'));
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
       ->distinct()
155
       ->distinct()
156
       ->get();
156
       ->get();
157
     $rubric = $this->rubric[0];
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
 
214
 
211
 
215
 
212
 
216
 
213
-    foreach ($outcomes as $outcome) {
217
+    foreach ($outcomes_dict as $outcome) {
214
       $ac_criteria = DB::table('criterion_objective_outcome as cobo')
218
       $ac_criteria = DB::table('criterion_objective_outcome as cobo')
215
         ->join('activity_criterion as ac', 'ac.criterion_id', '=', 'cobo.criterion_id')
219
         ->join('activity_criterion as ac', 'ac.criterion_id', '=', 'cobo.criterion_id')
216
         ->where("outcome_id", $outcome->id)
220
         ->where("outcome_id", $outcome->id)
266
 
270
 
267
 
271
 
268
 
272
 
273
+
274
+
269
       /*foreach ($students_attempted as $student) {
275
       /*foreach ($students_attempted as $student) {
270
         $student_criteria[$student];
276
         $student_criteria[$student];
271
       }
277
       }
278
           ->get();
284
           ->get();
279
       }*/
285
       }*/
280
     }
286
     }
281
-    return $outcomes;
287
+    return $outcomes_dict;
282
   }
288
   }
283
   // o_ach_array
289
   // o_ach_array
284
   public function getOAchArrayAttribute($value)
290
   public function getOAchArrayAttribute($value)

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

479
   {
479
   {
480
     return $this->getStudentReportForOutcome($this);
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
     if ($course_code) {
485
     if ($course_code) {
485
       //Log::info('entré');
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
       $program = Program::where('id', $course_code->program_id)->first();
527
       $program = Program::where('id', $course_code->program_id)->first();
491
       // // Log::info($program->code);
528
       // // Log::info($program->code);
492
       if ($program->code == "") {
529
       if ($program->code == "") {
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
         ->join("students", 'course_student.student_id', '=', 'students.id')
550
         ->join("students", 'course_student.student_id', '=', 'students.id')
511
         ->join('courses', 'courses.id', '=', 'course_student.course_id')
551
         ->join('courses', 'courses.id', '=', 'course_student.course_id')
512
         ->join('activities', 'activities.course_id', '=', 'courses.id')
552
         ->join('activities', 'activities.course_id', '=', 'courses.id')
516
         ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
556
         ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
517
 
557
 
518
         ->join('assessments', function ($join) {
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
             ->on('assessments.activity_criterion_id', '=', 'activity_criterion.id');
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
         ->select('students.number as student_id')
596
         ->select('students.number as student_id')
530
         ->addSelect(DB::raw('count(assessments.activity_criterion_id) as criteria_attempted'))
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
       //Log::info($criteria_id);
684
       //Log::info($criteria_id);
539
-      Log::info('los courseCode');
685
+      // Log::info('los courseCode');
540
       // Log::info(array($course_code));
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
       return $students;
698
       return $students;
617
       $students_attempted = Criterion::students_attempted($criterion->id, $criterion->activity_id);
767
       $students_attempted = Criterion::students_attempted($criterion->id, $criterion->activity_id);
618
       $students_achieved = Criterion::students_achieved($criterion->id, $criterion->activity_id);
768
       $students_achieved = Criterion::students_achieved($criterion->id, $criterion->activity_id);
619
 
769
 
620
-      Log::info('estamos aqui');
770
+      //Log::info('estamos aqui');
621
       Log::info($students_attempted);
771
       Log::info($students_attempted);
622
 
772
 
623
       if ($students_attempted) {
773
       if ($students_attempted) {

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

117
                 ->select('transformative_actions.*')
117
                 ->select('transformative_actions.*')
118
                 ->get();
118
                 ->get();
119
             $course_code->future_typ_course_id = Course::getFutureTypSemesterCourses($course_code->typ_semester_course_id, $course_code->program_id);
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
             $course_code->students = Course::getStudentReportForOutcome($course_code);
122
             $course_code->students = Course::getStudentReportForOutcome($course_code);
123
             //Log::info(array($course_code));
123
             //Log::info(array($course_code));

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

69
 		$whole_dict = [];
69
 		$whole_dict = [];
70
 		foreach ($this->annual_objectives as $objective) {
70
 		foreach ($this->annual_objectives as $objective) {
71
 			foreach ($objective->grouped_annual_course as $course_code) {
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
 				foreach ($course_code->student_report_for_outcome as $student) {
74
 				foreach ($course_code->student_report_for_outcome as $student) {
75
 
75
 
76
 					//If is not defined, define
76
 					//If is not defined, define

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

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

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

278
             xAxis: {
278
             xAxis: {
279
                 categories: [
279
                 categories: [
280
                     @foreach($outcomes as $outcome)
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
                 labels: {
294
                 labels: {
285
                     style: {
295
                     style: {
296
                 min: 0,
306
                 min: 0,
297
                 max: 100,
307
                 max: 100,
298
                 title: {
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
             tooltip: {
327
             tooltip: {
303
                 headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
328
                 headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
318
                 groupPadding: 0.075
343
                 groupPadding: 0.075
319
                 },
344
                 },
320
             },
345
             },
321
-            series: [{
346
+            series: [{{--{
322
                 name: 'Expected Value',
347
                 name: 'Expected Value',
323
                 color: '#555555',
348
                 color: '#555555',
324
                 dataLabels: {
349
                 dataLabels: {
332
                     },
357
                     },
333
                     y:-1
358
                     y:-1
334
                 }, 
359
                 }, 
335
-                <?php
336
-                Log::info('program_item');
337
-                Log::info($program_item);
338
 
360
 
339
-                ?>
361
+            
340
                 data: [
362
                 data: [
341
                     @foreach($outcomes as $index => $outcome)
363
                     @foreach($outcomes as $index => $outcome)
342
                         @if(
364
                         @if(
350
                     @endforeach
372
                     @endforeach
351
                 ]
373
                 ]
352
 
374
 
353
-            },{
375
+            },--}}{
354
                 name: 'Obtained Value',
376
                 name: 'Obtained Value',
355
                 color: '#e70033',
377
                 color: '#e70033',
356
                 dataLabels: {
378
                 dataLabels: {

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

410
                     // Select associated outcome
410
                     // Select associated outcome
411
                     $(".removable-outcome").remove();
411
                     $(".removable-outcome").remove();
412
                     $('.warning-objective').remove();
412
                     $('.warning-objective').remove();
413
+                    $("#assoc_outcome0").attr('data-old-outcome-id',json.outcome[0].outcome_id);
413
                     $('#assoc_outcome0').val(json.outcome[0].outcome_id);
414
                     $('#assoc_outcome0').val(json.outcome[0].outcome_id);
414
 
415
 
415
                     disabled = 0;
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
                         $('#assoc_outcome0').attr('disabled', true);
420
                         $('#assoc_outcome0').attr('disabled', true);
418
                         disabled = 1;
421
                         disabled = 1;
419
                     } else $('#assoc_outcome0').attr('disabled', false);
422
                     } else $('#assoc_outcome0').attr('disabled', false);
426
                             'name': "assoc_outcome[]",
429
                             'name': "assoc_outcome[]",
427
                             'data-live-search': 'true',
430
                             'data-live-search': 'true',
428
                             'id': 'assoc_outcome' + i.toString(),
431
                             'id': 'assoc_outcome' + i.toString(),
432
+                            'data-old-outcome-id': json.outcome[i].outcome_id
429
 
433
 
430
 
434
 
431
                         });
435
                         });
448
 
452
 
449
                         $div.appendTo('#assocOutcomeGroup')
453
                         $div.appendTo('#assocOutcomeGroup')
450
                         $select.append(selectOptions);
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
                             $select.attr('disabled', true);
457
                             $select.attr('disabled', true);
454
                             $button.attr('disabled', true);
458
                             $button.attr('disabled', true);
455
                             disabled = 1;
459
                             disabled = 1;
480
                         }).html('<span aria-hidden="true">×</span>');
484
                         }).html('<span aria-hidden="true">×</span>');
481
                         alert.append(button);
485
                         alert.append(button);
482
                         alert.append(
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
                         alert.appendTo($('#message_to_disconnect'))
490
                         alert.appendTo($('#message_to_disconnect'))
650
             e.preventDefault();
654
             e.preventDefault();
651
             newOutcomes = [];
655
             newOutcomes = [];
652
             $('#assocOutcomeGroup').find('select').each(function() {
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
                     option = $(this).find(':selected');
658
                     option = $(this).find(':selected');
655
                     newOutcomes.push(option[0].text);
659
                     newOutcomes.push(option[0].text);
656
                 }
660
                 }
676
         })
680
         })
677
         //Terrible notation but
681
         //Terrible notation but
678
 
682
 
683
+
679
         pair_every_criteria_with_objective = 0;
684
         pair_every_criteria_with_objective = 0;
680
         $('#update_button').on('click', function(e) {
685
         $('#update_button').on('click', function(e) {
681
             e.preventDefault();
686
             e.preventDefault();

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

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

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

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

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

499
     text: 'Performance by Learning Outcome Criteria in {{ $title }}'
499
     text: 'Performance by Learning Outcome Criteria in {{ $title }}'
500
     },
500
     },
501
     xAxis: {
501
     xAxis: {
502
-    categories: [
502
+    categories: [ 
503
     @foreach ($outcomes as $outcome)
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
             <?php
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
         @else
515
         @else
587
     },
590
     },
588
     data:[
591
     data:[
589
     @foreach ($outcomes as $index => $outcome)
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
         @else
599
         @else
593
             0,
600
             0,
594
         @endif
601
         @endif

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

248
 @stop
248
 @stop
249
 
249
 
250
 @section('javascript')
250
 @section('javascript')
251
+
252
+<?php
253
+$student_ach = $course->student_report_for_outcome;
254
+?>
251
 $(function () {
255
 $(function () {
252
     $('#graph').highcharts({
256
     $('#graph').highcharts({
253
         chart: {
257
         chart: {
261
                 @foreach($outcomes as $outcome)
265
                 @foreach($outcomes as $outcome)
262
 
266
 
263
                 @if(
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
                     <?php
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
                         else $achieved = 0;
277
                         else $achieved = 0;
274
                     ?>
278
                     ?>
358
             data:[
362
             data:[
359
                 @foreach($outcomes as $index => $outcome)
363
                 @foreach($outcomes as $index => $outcome)
360
                     @if(
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
                     @else
372
                     @else
367
                         0,
373
                         0,
368
                     @endif
374
                     @endif

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

106
 function loadGraphs() {
106
 function loadGraphs() {
107
 
107
 
108
     @foreach($grouped_courses as $index=>$grouped_course)
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
         // Load grad charts after clicking tab, so they are sized correctly.  
115
         // Load grad charts after clicking tab, so they are sized correctly.  
110
         $('#graph-{{ $index }}').highcharts({
116
         $('#graph-{{ $index }}').highcharts({
111
             chart: {
117
             chart: {
120
                     	@if($outcome->level==3 || ($grouped_course->program->is_graduate==0 && $outcome->level==1))
126
                     	@if($outcome->level==3 || ($grouped_course->program->is_graduate==0 && $outcome->level==1))
121
 
127
 
122
                             @if(
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
                                 <?php
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
                                     else $achieved = 0;
138
                                     else $achieved = 0;
133
                                 ?>
139
                                 ?>
234
                     ?>
240
                     ?>
235
 					@if($outcome->level==3 || ($grouped_course->program->is_graduate==0 && $outcome->level==1))
241
 					@if($outcome->level==3 || ($grouped_course->program->is_graduate==0 && $outcome->level==1))
236
                         @if(
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
                         @else
248
                         @else
242
                             0,
249
                             0,
243
                         @endif
250
                         @endif