Browse Source

varios bugs resueltos

parent
commit
17e1a9357d

+ 5
- 1
app/controllers/ActivitiesController.php View File

137
             $active_semesters[] = $active_semester->id;
137
             $active_semesters[] = $active_semester->id;
138
         }
138
         }
139
 
139
 
140
-        Log::info($active_semesters);
140
+//         Log::info($active_semesters);
141
         // Added the function htmlspecialchars to activity name string because it was corrupting Jquery code while using quotes on page rendering. - Carlos R Caraballo 1/18/2019
141
         // Added the function htmlspecialchars to activity name string because it was corrupting Jquery code while using quotes on page rendering. - Carlos R Caraballo 1/18/2019
142
         $title = $course->code . $course->number . '-' . $course->section . ': ' . htmlspecialchars($activity->name, ENT_QUOTES) . ' <span class="small attention">(' . $course->semester->code . ')</span>';
142
         $title = $course->code . $course->number . '-' . $course->section . ': ' . htmlspecialchars($activity->name, ENT_QUOTES) . ' <span class="small attention">(' . $course->semester->code . ')</span>';
143
 
143
 
162
             ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
162
             ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
163
             ->join('activities', 'activities.id', '=', 'activity_criterion.activity_id')
163
             ->join('activities', 'activities.id', '=', 'activity_criterion.activity_id')
164
             ->where('activity_id', $activity->id)
164
             ->where('activity_id', $activity->id)
165
+            ->whereNotNull('score')
165
             ->get();
166
             ->get();
166
         //if ($assessment) {
167
         //if ($assessment) {
167
         //    $outcomes_achieved = $activity->o_ach_array;
168
         //    $outcomes_achieved = $activity->o_ach_array;
191
             ->join('transformative_actions', 'transformative_activity_criterion.trans_action_id', '=', 'transformative_actions.id')
192
             ->join('transformative_actions', 'transformative_activity_criterion.trans_action_id', '=', 'transformative_actions.id')
192
             ->where('activity_criterion.activity_id', $id)
193
             ->where('activity_criterion.activity_id', $id)
193
             ->get();
194
             ->get();
195
+  
196
+          Log::info(json_encode($activity->cap_array));
197
+
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'));
198
         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'));
195
     }
199
     }
196
 
200
 

+ 15
- 10
app/controllers/AnnualPlansController.php View File

750
     $outcome = Outcome::where('id', $outcome_id)
750
     $outcome = Outcome::where('id', $outcome_id)
751
       ->addSelect('outcomes.*', DB::raw("'{$typ_semester_outcome_id}' as typ_semester_outcome_id"), DB::raw("'{$semester_id}' as `semester_id`"), DB::raw("'{$program_id}' as `program_id`"))
751
       ->addSelect('outcomes.*', DB::raw("'{$typ_semester_outcome_id}' as typ_semester_outcome_id"), DB::raw("'{$semester_id}' as `semester_id`"), DB::raw("'{$program_id}' as `program_id`"))
752
       ->first();
752
       ->first();
753
-    $outcome->objectives = $outcome->fetchObjectivesReport($semester_id, $program_id);
753
+//     Log::info("Comments");    
754
+ Log::info('En AnnualPlansController antes'.json_encode($outcome->objectives));		//exit();
755
+ 	unset($outcome->objectives);
756
+    $outcome->objectives2 = $outcome->fetchObjectivesReport($semester_id, $program_id);
757
+    Log::info("En AnnualPlansController".$semester_id." ". $program_id); //exit();    
758
+ Log::info('En AnnualPlansController'.json_encode($outcome->objectives2));		//exit();
759
+    foreach ($outcome->objectives2 as $index => $objective) {
760
+      //       Log::info("Ella son besties");
761
+      //       Log::info(array($objective));
762
+      $objective->courses = Objective::getPlanReport($objective);
763
+//       $outcome->objectives[$index]->courses = Objective::getPlanReport($objective);
764
+    }
765
+   
754
     $outcome->outcome_program_goal = DB::table('target_outcomes_program')
766
     $outcome->outcome_program_goal = DB::table('target_outcomes_program')
755
       ->where('program_id', $program_id)
767
       ->where('program_id', $program_id)
756
       ->where('semester_id', $semester_id)
768
       ->where('semester_id', $semester_id)
773
     //  ->toSql());
785
     //  ->toSql());
774
     //Log::info($outcome->comments);
786
     //Log::info($outcome->comments);
775
     $outcome->transformative_actions_categories_html = TransformativeAction::getCategoriesHtml($program_id);
787
     $outcome->transformative_actions_categories_html = TransformativeAction::getCategoriesHtml($program_id);
776
-
777
-
778
-
779
-
780
-    foreach ($outcome->objectives as $index => $objective) {
781
-      //       Log::info("Ella son besties");
782
-      //       Log::info(array($objective));
783
-      $objective->courses = Objective::getPlanReport($objective);
784
-    }
788
+// 	Log::info("Ella son besties".json_encode($outcome->objectives));
789
+// exit();
785
 
790
 
786
     return $outcome;
791
     return $outcome;
787
   }
792
   }

+ 0
- 3
app/controllers/OutcomesController.php View File

1054
 
1054
 
1055
 
1055
 
1056
         $annual_plans = DB::select("
1056
         $annual_plans = DB::select("
1057
-    
1058
         select 
1057
         select 
1059
           academic_year, 
1058
           academic_year, 
1060
           semester_start, 
1059
           semester_start, 
1065
         from annual_plans 
1064
         from annual_plans 
1066
         join annual_cycle on annual_cycle_id = annual_cycle.id 
1065
         join annual_cycle on annual_cycle_id = annual_cycle.id 
1067
         where program_id = {$program_id} 
1066
         where program_id = {$program_id} 
1068
-        
1069
-        
1070
           order by semester_start desc");
1067
           order by semester_start desc");
1071
         $program = DB::table('programs')
1068
         $program = DB::table('programs')
1072
             ->where('id', $program_id)
1069
             ->where('id', $program_id)

+ 8
- 2
app/controllers/ThreeYearPlanController.php View File

101
   {
101
   {
102
 
102
 
103
     $path = DB::table('paths_for_three_year_plans')->where('id', $path_id)->first();
103
     $path = DB::table('paths_for_three_year_plans')->where('id', $path_id)->first();
104
+    Log::info($path->path_to_pdf);
104
 
105
 
105
-    if (isset($path)) {
106
+    if (isset($path) and file_exists($path->path_to_pdf)) {
106
 
107
 
107
       $path = trim($path->path_to_pdf, app_path() . "/views/three_year_plan_htmls/");
108
       $path = trim($path->path_to_pdf, app_path() . "/views/three_year_plan_htmls/");
109
+//     Log::info($path);
108
       $path = trim($path, ".blade.php");
110
       $path = trim($path, ".blade.php");
109
-      return View::make("three_year_plan_htmls." . $path);
111
+//     Log::info($path);
112
+//       if (file_exists("three_year_plan_htmls." .$path)) 
113
+      {
114
+	      return View::make("three_year_plan_htmls." . $path);
115
+      }
110
     }
116
     }
111
     Session::flash('status', 'warning');
117
     Session::flash('status', 'warning');
112
     Session::flash('message', 'Error loading typ. Please try again later.');
118
     Session::flash('message', 'Error loading typ. Please try again later.');

+ 5
- 5
app/database/seeds/CourseStudentTableSeeder.php View File

15
         $time_start = microtime(true);
15
         $time_start = microtime(true);
16
 
16
 
17
         // Open file
17
         // Open file
18
-        if($file = fopen('app/database/csv/estusLabC21.txt', 'r'))
18
+        if($file = fopen('app/database/csv/estusEspaIngl.txt', 'r'))
19
         {
19
         {
20
             // Initialize count variables
20
             // Initialize count variables
21
             $read = 0;
21
             $read = 0;
96
             }
96
             }
97
 
97
 
98
             // Delete all inactive users for current term
98
             // Delete all inactive users for current term
99
-            DB::table('course_student')
100
-                ->where('updated_at', '<', date('Y-m-d'))
101
-                ->where('semester_id', $semester_id)
102
-                ->delete();
99
+//             DB::table('course_student')
100
+//                 ->where('updated_at', '<', date('Y-m-d'))
101
+//                 ->where('semester_id', $semester_id)
102
+//                 ->delete();
103
 
103
 
104
             // Stop time
104
             // Stop time
105
             $time_end = microtime(true);
105
             $time_end = microtime(true);

+ 24
- 11
app/models/Activity.php View File

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

+ 11
- 0
app/models/Course.php View File

165
         $join->on("assessments.student_id", '=', 'program_student_semester.student_id')
165
         $join->on("assessments.student_id", '=', 'program_student_semester.student_id')
166
           ->on('assessments.activity_criterion_id', '=', 'activity_criterion.id');
166
           ->on('assessments.activity_criterion_id', '=', 'activity_criterion.id');
167
       })
167
       })
168
+      ->whereNotNull('score')
168
       ->where('courses.semester_id', $this->semester_id)
169
       ->where('courses.semester_id', $this->semester_id)
169
       ->whereIn('courses.program_id', $program_ids)
170
       ->whereIn('courses.program_id', $program_ids)
170
       ->where('courses.code', $this->code)
171
       ->where('courses.code', $this->code)
222
     $activitiesAssessed = DB::table('activities')
223
     $activitiesAssessed = DB::table('activities')
223
       ->join('activity_criterion as ac', 'ac.activity_id', '=', 'activities.id')
224
       ->join('activity_criterion as ac', 'ac.activity_id', '=', 'activities.id')
224
       ->join('assessments', 'assessments.activity_criterion_id', '=', 'ac.id')
225
       ->join('assessments', 'assessments.activity_criterion_id', '=', 'ac.id')
226
+	  ->whereNotNull('score')
225
       ->where('activities.course_id', $this->id)
227
       ->where('activities.course_id', $this->id)
226
       ->select('activities.id')
228
       ->select('activities.id')
227
       ->distinct()
229
       ->distinct()
335
     $activitiesAssessed = DB::table('activities')
337
     $activitiesAssessed = DB::table('activities')
336
       ->join('activity_criterion as ac', 'ac.activity_id', '=', 'activities.id')
338
       ->join('activity_criterion as ac', 'ac.activity_id', '=', 'activities.id')
337
       ->join('assessments', 'assessments.activity_criterion_id', '=', 'ac.id')
339
       ->join('assessments', 'assessments.activity_criterion_id', '=', 'ac.id')
340
+	  ->whereNotNull('score')
338
       ->where('activities.course_id', $this->id)
341
       ->where('activities.course_id', $this->id)
339
       ->where('activities.draft', 0)
342
       ->where('activities.draft', 0)
340
       ->where('activities.diagnostic', 0)
343
       ->where('activities.diagnostic', 0)
349
     $activitiesAssessed = DB::table('activities')
352
     $activitiesAssessed = DB::table('activities')
350
       ->join('activity_criterion as ac', 'ac.activity_id', '=', 'activities.id')
353
       ->join('activity_criterion as ac', 'ac.activity_id', '=', 'activities.id')
351
       ->join('assessments', 'assessments.activity_criterion_id', '=', 'ac.id')
354
       ->join('assessments', 'assessments.activity_criterion_id', '=', 'ac.id')
355
+	  ->whereNotNull('score')
352
       ->where('activities.course_id', $this->id)
356
       ->where('activities.course_id', $this->id)
353
       ->where('activities.draft', 0)
357
       ->where('activities.draft', 0)
354
       ->where('activities.diagnostic', 1)
358
       ->where('activities.diagnostic', 1)
450
           $join->on("assessments.student_id", '=', 'program_student_semester.student_id')
454
           $join->on("assessments.student_id", '=', 'program_student_semester.student_id')
451
             ->on('assessments.activity_criterion_id', '=', 'activity_criterion.id');
455
             ->on('assessments.activity_criterion_id', '=', 'activity_criterion.id');
452
         })
456
         })
457
+  	    ->whereNotNull('score')
453
         ->where('courses.semester_id', $course_code->semester_id)
458
         ->where('courses.semester_id', $course_code->semester_id)
454
         ->whereIn('courses.program_id', $program_ids)
459
         ->whereIn('courses.program_id', $program_ids)
455
         ->where('courses.code', $course_code->code)
460
         ->where('courses.code', $course_code->code)
578
         ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
583
         ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
579
         ->join('semesters', 'semesters.id', '=', 'courses.semester_id')
584
         ->join('semesters', 'semesters.id', '=', 'courses.semester_id')
580
         ->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
585
         ->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
586
+	    ->whereNotNull('score')
581
         ->whereIn('students.program_id', $program_ids)
587
         ->whereIn('students.program_id', $program_ids)
582
         ->where('semester_id', $course_code->semester_id)
588
         ->where('semester_id', $course_code->semester_id)
583
         ->where('semesters.is_visible', '=', 1)
589
         ->where('semesters.is_visible', '=', 1)
613
           $join->on("assessments.student_id", '=', 'course_student.student_id')
619
           $join->on("assessments.student_id", '=', 'course_student.student_id')
614
             ->on('assessments.activity_criterion_id', '=', 'activity_criterion.id');
620
             ->on('assessments.activity_criterion_id', '=', 'activity_criterion.id');
615
         })
621
         })
622
+	    ->whereNotNull('score')
616
         ->where('activities.draft', 0)
623
         ->where('activities.draft', 0)
617
         ->where('activities.diagnostic', 0);
624
         ->where('activities.diagnostic', 0);
618
 
625
 
786
        count(case when assessments.score >= rubrics.expected_points then 1 else NULL end) as achieved,
793
        count(case when assessments.score >= rubrics.expected_points then 1 else NULL end) as achieved,
787
        criteria.*"
794
        criteria.*"
788
       ))
795
       ))
796
+	  ->whereNotNull('score')
789
       ->where('courses.id', $this->id)
797
       ->where('courses.id', $this->id)
790
       ->groupBy('criteria.id')
798
       ->groupBy('criteria.id')
791
       ->get();
799
       ->get();
805
         count(case when assessments.score >= rubrics.expected_points then 1 else null end) as achieved"
813
         count(case when assessments.score >= rubrics.expected_points then 1 else null end) as achieved"
806
         )
814
         )
807
       )
815
       )
816
+	  ->whereNotNull('score')
808
       ->where('courses.id', $this->id)
817
       ->where('courses.id', $this->id)
809
       ->groupBy(array('outcome_id', 'student_id'))
818
       ->groupBy(array('outcome_id', 'student_id'))
810
       ->get();
819
       ->get();
883
         'program_id',
892
         'program_id',
884
         $this->program_id
893
         $this->program_id
885
       )
894
       )
895
+	  ->whereNotNull('score')
886
       ->where('activities.draft', 0)
896
       ->where('activities.draft', 0)
887
       ->where('activities.diagnostic', 0)
897
       ->where('activities.diagnostic', 0)
888
       ->groupBy('courses.id')
898
       ->groupBy('courses.id')
896
     $assessed = DB::table('assessments')
906
     $assessed = DB::table('assessments')
897
       ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
907
       ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
898
       ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
908
       ->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
909
+	  ->whereNotNull('score')
899
       ->where('activities.course_id', $this->id)
910
       ->where('activities.course_id', $this->id)
900
       ->count();
911
       ->count();
901
     //             Log::info("aqui".$assessed);
912
     //             Log::info("aqui".$assessed);

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

145
 
145
 
146
 			$students_achieved += DB::table('assessments')
146
 			$students_achieved += DB::table('assessments')
147
 				->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
147
 				->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
148
+				->whereNotNull('score')
148
 				->where('activity_criterion.id', $activity_criterion->id)
149
 				->where('activity_criterion.id', $activity_criterion->id)
149
 				->where('assessments.score', '>=', $activity_criterion->expected_points)
150
 				->where('assessments.score', '>=', $activity_criterion->expected_points)
150
 				->count();
151
 				->count();

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

101
     // 
101
     // 
102
     public static function getPlanReport($objective)
102
     public static function getPlanReport($objective)
103
     {
103
     {
104
+        Log::info("getPlanReport". json_encode($objective));//exit();
104
         $course_codes = DB::table('typ_semester_courses')
105
         $course_codes = DB::table('typ_semester_courses')
105
             ->join('courses', 'courses.id', '=', 'typ_semester_courses.course_id')
106
             ->join('courses', 'courses.id', '=', 'typ_semester_courses.course_id')
106
             ->where('typ_semester_objective_id', $objective->typ_semester_objective_id)
107
             ->where('typ_semester_objective_id', $objective->typ_semester_objective_id)
108
             ->select('courses.code', 'courses.number', 'courses.id as course_id', 'typ_semester_courses.id as typ_semester_course_id', DB::raw("{$objective->semester_id} as semester_id"), "courses.program_id")
109
             ->select('courses.code', 'courses.number', 'courses.id as course_id', 'typ_semester_courses.id as typ_semester_course_id', DB::raw("{$objective->semester_id} as semester_id"), "courses.program_id")
109
             ->get();
110
             ->get();
110
         //Log::info($course_codes);
111
         //Log::info($course_codes);
111
-        Log::info("No es aqui");
112
+//         Log::info("No es aqui");
112
 
113
 
113
         //$course_codes['studentPerOutcome'] = array();
114
         //$course_codes['studentPerOutcome'] = array();
114
 
115
 

+ 7
- 4
app/models/Outcome.php View File

186
 			->select('objectives.id as objective_id', 'objectives.text', 'typ_semester_objectives.id as typ_semester_objective_id', 'program_id', 'semester_id')
186
 			->select('objectives.id as objective_id', 'objectives.text', 'typ_semester_objectives.id as typ_semester_objective_id', 'program_id', 'semester_id')
187
 			->distinct();
187
 			->distinct();
188
 
188
 
189
-		Log::info('agooooo me');
190
-		////Log::info($objectives->toSql());
189
+// 		Log::info('agooooo me');
190
+// 		Log::info($objectives->toSql());exit();
191
 		//Log::info('semester_program_outcome' . $semester_id . ',' . $program_id . ',' . $this->id);
191
 		//Log::info('semester_program_outcome' . $semester_id . ',' . $program_id . ',' . $this->id);
192
 
192
 
193
 		if ($with_model) {
193
 		if ($with_model) {
210
 			return $objectives;
210
 			return $objectives;
211
 		}
211
 		}
212
 
212
 
213
-
214
-		return $objectives->get();
213
+// 		Log::info('agooooo me');
214
+		$objectives_result=$objectives->get();
215
+ Log::info('En fetchObjectivesReport'.json_encode($objectives_result));		//exit();
216
+		return $objectives_result;
217
+// 		return $objectives;
215
 	}
218
 	}
216
 
219
 
217
 	//Intento de get objectives pareados en un plan
220
 	//Intento de get objectives pareados en un plan

+ 4
- 1
app/models/Program.php View File

74
 			->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
74
 			->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
75
 			->join('semesters', 'semesters.id', '=', 'courses.semester_id')
75
 			->join('semesters', 'semesters.id', '=', 'courses.semester_id')
76
 			->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
76
 			->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
77
+      		->whereNotNull('score')
77
 			->where('students.program_id', $this->id)
78
 			->where('students.program_id', $this->id)
78
 			->whereIn('semester_id', Session::get('semesters_ids'))
79
 			->whereIn('semester_id', Session::get('semesters_ids'))
79
 			->where('semesters.is_visible', '=', 1)
80
 			->where('semesters.is_visible', '=', 1)
211
 	public function getCoursesWithAssessmentCountAttribute()
212
 	public function getCoursesWithAssessmentCountAttribute()
212
 	{
213
 	{
213
 		return DB::table('courses')
214
 		return DB::table('courses')
214
-			->join(DB::raw("(SELECT distinct courses.* from courses join activities on activities.course_id = courses.id join activity_criterion on activity_criterion.activity_id = activities.id join assessments on activity_criterion.id = assessments.activity_criterion_id) as q"), function ($j) {
215
+			->join(DB::raw("(SELECT distinct courses.* from courses join activities on activities.course_id = courses.id join activity_criterion on activity_criterion.activity_id = activities.id join assessments on activity_criterion.id = assessments.activity_criterion_id and score is not null) as q"), function ($j) {
215
 				$j->on('q.semester_id', '=', 'courses.semester_id')
216
 				$j->on('q.semester_id', '=', 'courses.semester_id')
216
 					->on('q.program_id', '=', 'courses.program_id');
217
 					->on('q.program_id', '=', 'courses.program_id');
217
 			})
218
 			})
245
 			->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
246
 			->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
246
 			->join('semesters', 'semesters.id', '=', 'courses.semester_id')
247
 			->join('semesters', 'semesters.id', '=', 'courses.semester_id')
247
 			->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
248
 			->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
249
+      		->whereNotNull('score')
248
 			->where('courses.program_id', $this->id)
250
 			->where('courses.program_id', $this->id)
249
 			->whereIn('semester_id', Session::get('semesters_ids'))
251
 			->whereIn('semester_id', Session::get('semesters_ids'))
250
 			->where('semesters.is_visible', '=', 1)
252
 			->where('semesters.is_visible', '=', 1)
377
 		foreach ($this->publishedActivities as $activity) {
379
 		foreach ($this->publishedActivities as $activity) {
378
 			$assessed = DB::table('activity_criterion')
380
 			$assessed = DB::table('activity_criterion')
379
 				->join('assessments', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
381
 				->join('assessments', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
382
+     		 	->whereNotNull('score')
380
 				->where('activity_id', $activity->id)
383
 				->where('activity_id', $activity->id)
381
 				->first();
384
 				->first();
382
 			if (!$assessed) continue;
385
 			if (!$assessed) continue;

+ 4
- 0
app/models/School.php View File

82
 			->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
82
 			->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
83
 			->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
83
 			->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
84
 			->join('semesters', 'semesters.id', '=', 'courses.semester_id')
84
 			->join('semesters', 'semesters.id', '=', 'courses.semester_id')
85
+      		->whereNotNull('score')
85
 			->whereIn('courses.program_id', $this->undergraduate_programs->lists('id'))
86
 			->whereIn('courses.program_id', $this->undergraduate_programs->lists('id'))
86
 			->whereIn('semester_id', Session::get('semesters_ids'))
87
 			->whereIn('semester_id', Session::get('semesters_ids'))
87
 			->where('semesters.is_visible', '=', 1)
88
 			->where('semesters.is_visible', '=', 1)
109
 			->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
110
 			->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
110
 			->join('semesters', 'semesters.id', '=', 'courses.semester_id')
111
 			->join('semesters', 'semesters.id', '=', 'courses.semester_id')
111
 			->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
112
 			->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
113
+	      	->whereNotNull('score')
112
 			->whereIn('courses.program_id', $this->graduate_programs->lists('id'))
114
 			->whereIn('courses.program_id', $this->graduate_programs->lists('id'))
113
 			->whereIn('semester_id', Session::get('semesters_ids'))
115
 			->whereIn('semester_id', Session::get('semesters_ids'))
114
 			->where('semesters.is_visible', '=', 1)
116
 			->where('semesters.is_visible', '=', 1)
429
 			->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
431
 			->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
430
 			->join('semesters', 'semesters.id', '=', 'courses.semester_id')
432
 			->join('semesters', 'semesters.id', '=', 'courses.semester_id')
431
 			->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
433
 			->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
434
+	      	->whereNotNull('score')
432
 			->whereIn('students.program_id', $this->undergraduate_programs->lists('id'))
435
 			->whereIn('students.program_id', $this->undergraduate_programs->lists('id'))
433
 			->whereIn('semester_id', Session::get('semesters_ids'))
436
 			->whereIn('semester_id', Session::get('semesters_ids'))
434
 			->where('semesters.is_visible', '=', 1)
437
 			->where('semesters.is_visible', '=', 1)
456
 			->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
459
 			->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
457
 			->join('semesters', 'semesters.id', '=', 'courses.semester_id')
460
 			->join('semesters', 'semesters.id', '=', 'courses.semester_id')
458
 			->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
461
 			->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
462
+	      	->whereNotNull('score')
459
 			->whereIn('students.program_id', $this->graduate_programs->lists('id'))
463
 			->whereIn('students.program_id', $this->graduate_programs->lists('id'))
460
 			->whereIn('semester_id', Session::get('semesters_ids'))
464
 			->whereIn('semester_id', Session::get('semesters_ids'))
461
 			->where('semesters.is_visible', '=', 1)
465
 			->where('semesters.is_visible', '=', 1)

+ 6
- 4
app/routes.php View File

208
         'uses' => 'AnnualPlansController@selectProgramPlan'
208
         'uses' => 'AnnualPlansController@selectProgramPlan'
209
     ));
209
     ));
210
 
210
 
211
-    Route::post("fetchReportWithOutcome", array(
212
-        'as' => 'fetchReportWithOutcome',
213
-        'uses' => 'AnnualPlansController@fetchReportWithOutcome'
214
-    ));
211
+    Route::post("fetchReportWithOutcome", 'AnnualPlansController@fetchReportWithOutcome');
212
+
213
+//     Route::post("fetchReportWithOutcome", array(
214
+//         'as' => 'fetchReportWithOutcome',
215
+//         'uses' => 'AnnualPlansController@fetchReportWithOutcome'
216
+//     ));
215
 
217
 
216
     Route::get('annual_plan_report/{program_id}', array(
218
     Route::get('annual_plan_report/{program_id}', array(
217
         'as' => 'annual_plan_report/{program_id}',
219
         'as' => 'annual_plan_report/{program_id}',

+ 5
- 3
app/views/local/managers/shared/annual_report.blade.php View File

970
                     typ_semester_outcome_id: typ_semester_outcome_id
970
                     typ_semester_outcome_id: typ_semester_outcome_id
971
                 },
971
                 },
972
                 function(outcome) {
972
                 function(outcome) {
973
-                    if (outcome.objectives) {
973
+                        console.log("outcome: " + JSON.stringify(outcome));                
974
+                    if (outcome.objectives2) {
974
                         $('table').show();
975
                         $('table').show();
975
                         $('#outcome-display').parent().show();
976
                         $('#outcome-display').parent().show();
976
                         $('#outcome-display .panel-title').html(name);
977
                         $('#outcome-display .panel-title').html(name);
977
                         $('#allLists').empty();
978
                         $('#allLists').empty();
978
                         $('#levelTabs').empty();
979
                         $('#levelTabs').empty();
979
                         $('.no-outcome').hide();
980
                         $('.no-outcome').hide();
981
+//                         console.log("outcome: " + outcome.jSon());
980
                         if (outcome.outcome_program_goal) {
982
                         if (outcome.outcome_program_goal) {
981
                             outcome.outcome_program_goal = outcome.outcome_program_goal.expected_target;
983
                             outcome.outcome_program_goal = outcome.outcome_program_goal.expected_target;
982
                         } else {
984
                         } else {
1010
                             '<th>Percentage</th>' +
1012
                             '<th>Percentage</th>' +
1011
                             '<th>Outcome Achieved</th>' +
1013
                             '<th>Outcome Achieved</th>' +
1012
                             '</tr></thead><tbody></tbody>');
1014
                             '</tr></thead><tbody></tbody>');
1013
-                        first_objective_id = outcome.objectives[0].id;
1014
-                        $.each(outcome.objectives, function(index, objective) {
1015
+                        first_objective_id = outcome.objectives2[0].id;
1016
+                        $.each(outcome.objectives2, function(index, objective) {
1015
 
1017
 
1016
                             li = $('<li/>', {
1018
                             li = $('<li/>', {
1017
                                 'role': 'presentation',
1019
                                 'role': 'presentation',