Browse Source

final push

parent
commit
11011a01c3

+ 3
- 3
app/controllers/ActivitiesController.php View File

819
         $scores_array = array();
819
         $scores_array = array();
820
 
820
 
821
         foreach ($assessments as $index => $assessment) {
821
         foreach ($assessments as $index => $assessment) {
822
-            $scores_array[$assessment->student_id][$assessment->activity_criterion_id][] = $assessment->score;
822
+            $scores_array[$assessment->student_id][$assessment->activity_criterion_id] = $assessment->score;
823
             $scores_array[$assessment->student_id]['comments'] = DB::table('activity_student')->where('student_id', '=', $assessment->student_id)
823
             $scores_array[$assessment->student_id]['comments'] = DB::table('activity_student')->where('student_id', '=', $assessment->student_id)
824
                 ->where("activity_id", '=', $activity->id)
824
                 ->where("activity_id", '=', $activity->id)
825
                 ->select('comments')->first()->comments;
825
                 ->select('comments')->first()->comments;
858
             ->addSelect('rubric_criterion.rubric_id', 'rubric_criterion.id as rubric_criterion_id')
858
             ->addSelect('rubric_criterion.rubric_id', 'rubric_criterion.id as rubric_criterion_id')
859
             ->get();
859
             ->get();
860
         $rubric->titles = DB::table('titles')
860
         $rubric->titles = DB::table('titles')
861
-            ->join('rubric_title', 'rubric_title.titles_id', '=', 'titles.id')
861
+            ->join('rubric_title', 'rubric_title.title_id', '=', 'titles.id')
862
             ->where('rubric_id', $rubric->id)
862
             ->where('rubric_id', $rubric->id)
863
             ->orderBy("position", 'ASC')
863
             ->orderBy("position", 'ASC')
864
             ->lists('text');
864
             ->lists('text');
895
 
895
 
896
         foreach ($assessments as $index => $assessment) {
896
         foreach ($assessments as $index => $assessment) {
897
 
897
 
898
-            $scores_array[$assessment->student_id][] = $assessment->score;
898
+            $scores_array[$assessment->student_id][$assessment->activity_criterion_id] = $assessment->score;
899
             $scores_array[$assessment->student_id]['comments'] = DB::table('activity_student')->where('student_id', '=', $assessment->student_id)
899
             $scores_array[$assessment->student_id]['comments'] = DB::table('activity_student')->where('student_id', '=', $assessment->student_id)
900
                 ->where("activity_id", '=', $activity->id)
900
                 ->where("activity_id", '=', $activity->id)
901
                 ->select('comments')->first()->comments;
901
                 ->select('comments')->first()->comments;

+ 2
- 2
app/controllers/AnnualPlansController.php View File

212
 
212
 
213
       $typ_info['courses'][$objective->id] = DB::select("select c.id, c.number, c.code, typ.id typ_course_id from courses c, typ_semester_courses typ, (select course_id, id  from typ_semester_courses where typ_semester_objective_id in (select id from typ_semester_objectives where objective_id ={$objective->id} and typ_semester_outcome_id in (select id from typ_semester_outcome where outcome_id =? and semester_id ={$semester->id} and typ_program_id in(select id from typ_program where program_id ={$program_id})))) rel where typ.course_id =c.id and rel.course_id = c.id and typ.id = rel.id ", array(Input::get('id')));
213
       $typ_info['courses'][$objective->id] = DB::select("select c.id, c.number, c.code, typ.id typ_course_id from courses c, typ_semester_courses typ, (select course_id, id  from typ_semester_courses where typ_semester_objective_id in (select id from typ_semester_objectives where objective_id ={$objective->id} and typ_semester_outcome_id in (select id from typ_semester_outcome where outcome_id =? and semester_id ={$semester->id} and typ_program_id in(select id from typ_program where program_id ={$program_id})))) rel where typ.course_id =c.id and rel.course_id = c.id and typ.id = rel.id ", array(Input::get('id')));
214
 
214
 
215
-      $typ_info['criteria'][$objective->id] = DB::select("select * from criteria where id in (select criterion_id from criterion_objective_outcome where outcome_id = ? and objective_id = {$objective->id})", array(Input::get('id')));
215
+      $typ_info['criteria'][$objective->id] = DB::select("select * from criteria where deleted_at IS NULL and id in (select criterion_id from criterion_objective_outcome where outcome_id = ? and objective_id = {$objective->id})", array(Input::get('id')));
216
       Log::info($typ_info['criteria'][$objective->id]);
216
       Log::info($typ_info['criteria'][$objective->id]);
217
       $typ_info['typ_objective_id'][$objective->id] = DB::select("select id from typ_semester_objectives where objective_id = {$objective->id} and typ_semester_outcome_id in (select id from typ_semester_outcome where outcome_id =? and semester_id ={$semester->id} and typ_program_id in (select id from typ_program where program_id ={$program_id}))", array(Input::get('id')));
217
       $typ_info['typ_objective_id'][$objective->id] = DB::select("select id from typ_semester_objectives where objective_id = {$objective->id} and typ_semester_outcome_id in (select id from typ_semester_outcome where outcome_id =? and semester_id ={$semester->id} and typ_program_id in (select id from typ_program where program_id ={$program_id}))", array(Input::get('id')));
218
       Log::info($typ_info['typ_objective_id'][$objective->id]);
218
       Log::info($typ_info['typ_objective_id'][$objective->id]);
346
         $annual_plan['first']['typ_objective_id'][$objective->id] = DB::select("select id from typ_semester_objectives where objective_id = {$objective->id} and  typ_semester_outcome_id in (select id from typ_semester_outcome where outcome_id ={$outcomes->id} and semester_id ={$an_semesters->semester_start} and typ_program_id in(select id from typ_program where program_id ={$an_semesters->program_id})) ")[0];
346
         $annual_plan['first']['typ_objective_id'][$objective->id] = DB::select("select id from typ_semester_objectives where objective_id = {$objective->id} and  typ_semester_outcome_id in (select id from typ_semester_outcome where outcome_id ={$outcomes->id} and semester_id ={$an_semesters->semester_start} and typ_program_id in(select id from typ_program where program_id ={$an_semesters->program_id})) ")[0];
347
         $annual_plan['first']['courses'][$objective->id] = DB::select("select typ.id typ_course_id, typ.course_id, c.code, c.number from (select course_id, id from typ_semester_courses where typ_semester_objective_id = {$annual_plan['first']['typ_objective_id'][$objective->id]->id}) typ, courses c where c.id = typ.course_id");
347
         $annual_plan['first']['courses'][$objective->id] = DB::select("select typ.id typ_course_id, typ.course_id, c.code, c.number from (select course_id, id from typ_semester_courses where typ_semester_objective_id = {$annual_plan['first']['typ_objective_id'][$objective->id]->id}) typ, courses c where c.id = typ.course_id");
348
         foreach ($annual_plan['first']['courses'][$objective->id] as $course) {
348
         foreach ($annual_plan['first']['courses'][$objective->id] as $course) {
349
-          $annual_plan['first']['criteria'][$objective->id][$course->typ_course_id] = DB::select("select * from criteria where id in(select criteria_id from annual_plan_objective where annual_plan_id = {$an_id} and typ_semester_course_id = {$course->typ_course_id} )");
349
+          $annual_plan['first']['criteria'][$objective->id][$course->typ_course_id] = DB::select("select * from criteria where  id in(select criteria_id from annual_plan_objective where annual_plan_id = {$an_id} and typ_semester_course_id = {$course->typ_course_id} )");
350
           $annual_plan['first']['trans_actions'][$objective->id][$course->typ_course_id] = DB::select("select * from transformative_actions where id in (select trans_id from annual_plan_transformative where typ_semester_course_id = {$course->typ_course_id})");
350
           $annual_plan['first']['trans_actions'][$objective->id][$course->typ_course_id] = DB::select("select * from transformative_actions where id in (select trans_id from annual_plan_transformative where typ_semester_course_id = {$course->typ_course_id})");
351
         }
351
         }
352
 
352
 

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

794
             ->with(array('courses' => function ($query) {
794
             ->with(array('courses' => function ($query) {
795
                 $query
795
                 $query
796
                     ->has('activities')
796
                     ->has('activities')
797
-                    ->whereNotNull('outcomes_attempted')
797
+                    //->whereNotNull('outcomes_attempted')
798
+
798
                     ->whereIn('semester_id', Session::get('semesters_ids'))
799
                     ->whereIn('semester_id', Session::get('semesters_ids'))
799
                     ->groupBy(array('code', 'number'));
800
                     ->groupBy(array('code', 'number'));
800
             }))
801
             }))
801
             ->first();
802
             ->first();
803
+        Log::info($program);
802
 
804
 
803
         return View::make('local.managers.pCoords.assessment_report', compact('title', 'outcome', 'program'));
805
         return View::make('local.managers.pCoords.assessment_report', compact('title', 'outcome', 'program'));
804
     }
806
     }
810
         $semesters = DB::table('semesters')->whereIn('id', $semesters)->orderBy('start', 'ASC')->first();
812
         $semesters = DB::table('semesters')->whereIn('id', $semesters)->orderBy('start', 'ASC')->first();
811
         Log::info($semesters->start);
813
         Log::info($semesters->start);
812
         $outcomes = Outcome::select(array('id', 'name', 'expected_outcome'))
814
         $outcomes = Outcome::select(array('id', 'name', 'expected_outcome'))
813
-            ->where('deleted_at', '=', NULL)
814
-            ->whereRaw("(deactivation_date = NULL or deactivation_date >= '{$semesters->start}')")
815
+            ->whereNull('deleted_at')
816
+            ->whereRaw("(deactivation_date IS NULL or deactivation_date >= '{$semesters->start}')")
815
             ->orderBy('name', 'ASC')->get();
817
             ->orderBy('name', 'ASC')->get();
818
+
819
+        Log::info($outcomes);
816
         $title = "My Courses' Assessment Reports";
820
         $title = "My Courses' Assessment Reports";
817
 
821
 
818
         return View::make('local.professors.assessment_reports', compact('title', 'outcomes'));
822
         return View::make('local.professors.assessment_reports', compact('title', 'outcomes'));

+ 1
- 0
app/controllers/RubricsController.php View File

259
         Log::info('entré6???');
259
         Log::info('entré6???');
260
         DB::delete("delete from rubric_criterion where rubric_id ={$rubric->id}");
260
         DB::delete("delete from rubric_criterion where rubric_id ={$rubric->id}");
261
         DB::delete("delete from activity_criterion where activity_id = {$activity->id}");
261
         DB::delete("delete from activity_criterion where activity_id = {$activity->id}");
262
+        DB::delete("delete from rubric_title where rubric_id = {$rubric->id}");
262
         foreach ($criteria as $index => $criterion_id) {
263
         foreach ($criteria as $index => $criterion_id) {
263
 
264
 
264
 
265
 

+ 10
- 6
app/controllers/ThreeYearPlanController.php View File

8
   public function create()
8
   public function create()
9
   {
9
   {
10
     try {
10
     try {
11
+      DB::beginTransaction();
11
       $yearStart = Input::get('years') + 0;
12
       $yearStart = Input::get('years') + 0;
12
       $yearEnd = $yearStart + 3;
13
       $yearEnd = $yearStart + 3;
13
       DB::insert("insert into three_year_plan (`year_start`, `year_end`) values ({$yearStart}, {$yearEnd})");
14
       DB::insert("insert into three_year_plan (`year_start`, `year_end`) values ({$yearStart}, {$yearEnd})");
14
-      DB::commit();
15
+
15
       $typ = DB::table('three_year_plan')->where('year_start', '=', $yearStart)
16
       $typ = DB::table('three_year_plan')->where('year_start', '=', $yearStart)
16
         ->where('year_end', '=', $yearEnd)
17
         ->where('year_end', '=', $yearEnd)
17
         ->first();
18
         ->first();
26
         Log::info($typ->id);
27
         Log::info($typ->id);
27
         DB::insert("insert into typ_semesters (typ_id, semester_id) values ({$typ->id}, {$Firstsemester->id}), ({$typ->id}, {$secondSemester->id})");
28
         DB::insert("insert into typ_semesters (typ_id, semester_id) values ({$typ->id}, {$Firstsemester->id}), ({$typ->id}, {$secondSemester->id})");
28
       }
29
       }
29
-
30
+      DB::commit();
30
       Session::flash('status', 'success');
31
       Session::flash('status', 'success');
31
       Session::flash('message', '<p> Cycle created.</p>');
32
       Session::flash('message', '<p> Cycle created.</p>');
32
       return Redirect::to('three-years-plan');
33
       return Redirect::to('three-years-plan');
34
       Session::flash('status', 'danger');
35
       Session::flash('status', 'danger');
35
       Session::flash('message', "<p>Could not create cycle</p>");
36
       Session::flash('message', "<p>Could not create cycle</p>");
36
       Log::info($e);
37
       Log::info($e);
38
+      DB::rollback();
37
       return Redirect::to('three-years-plan');;
39
       return Redirect::to('three-years-plan');;
38
     }
40
     }
39
   }
41
   }
42
   {
44
   {
43
     $user_id = Auth::user()->id;
45
     $user_id = Auth::user()->id;
44
 
46
 
45
-    $last_year = DB::table('three_year_plan')->select('year_start')
46
-      ->orderBy('year_start', 'desc')->first();
47
+    $last_year = DB::table('three_year_plan')->select('year_end')
48
+      ->orderBy('year_end', 'desc')->first();
47
     if (!$last_year) {
49
     if (!$last_year) {
48
-      $last_year = date('Y');
50
+      // $last_year = date('Y');
51
+      $last_year = 2019;
49
     } else {
52
     } else {
50
-      $last_year = $last_year->year_start;
53
+      $last_year = $last_year->year_end;
51
     }
54
     }
52
 
55
 
56
+
53
     // el ID de los semestres que el usuario tiene seleccionado.
57
     // el ID de los semestres que el usuario tiene seleccionado.
54
     $semesters_ids = Session::get('semesters_ids');
58
     $semesters_ids = Session::get('semesters_ids');
55
     // buscar informacion de los semestres seleccionados
59
     // buscar informacion de los semestres seleccionados

+ 83
- 31
app/controllers/TransformativeActionsController.php View File

121
         ->get();
121
         ->get();
122
       $outcome_filter_editPanel = DB::table('transformative_actions')
122
       $outcome_filter_editPanel = DB::table('transformative_actions')
123
         ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
123
         ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
124
-        ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
125
-        ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
124
+        ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
125
+        ->join('outcomes', 'outcomes.id', '=', 'objective_outcome.outcome_id')
126
         ->where('transformative_actions.is_custom', 1)
126
         ->where('transformative_actions.is_custom', 1)
127
         ->where('transformative_actions.program_id', $program_id)
127
         ->where('transformative_actions.program_id', $program_id)
128
         ->where('transformative_actions.by_professor', 0)
128
         ->where('transformative_actions.by_professor', 0)
523
             array(
523
             array(
524
               'ta_id' => $ta_id,
524
               'ta_id' => $ta_id,
525
               'objective_id' => $new_id,
525
               'objective_id' => $new_id,
526
-              'created_at' => $current_timestamp,
526
+              // 'created_at' => $current_timestamp,
527
             )
527
             )
528
           );
528
           );
529
         } else {
529
         } else {
653
   public function selectTA()
653
   public function selectTA()
654
   {
654
   {
655
     $ta_id = Input::get("ta_id");
655
     $ta_id = Input::get("ta_id");
656
-    $user_id = Auth::user()->id;
657
-    $program_id = DB::table('program_user')
658
-      ->where('user_id', $user_id)
659
-      ->select('program_id')
660
-      ->get();
661
-    $program_id = $program_id[0]->program_id;
656
+    $user_role = Auth::user()->role;
657
+    switch ($user_role) {
658
+      case 1:
659
+
660
+        $program_ids = DB::table('programs')->lists('id');
661
+        break;
662
+      case 2:
663
+        $user_school = Auth::user()->school_id;
664
+        $program_ids = DB::table('programs')
665
+          ->where('school_id', $user_school)
666
+          ->lists('id');
667
+        break;
668
+
669
+      case 3:
670
+        $user_id = Auth::user()->id;
671
+        $program_ids = DB::table('program_user')
672
+          ->where('user_id', $user_id)
673
+          ->select('program_id')
674
+          ->lists('program_id');
675
+        break;
676
+    }
677
+    //$program_id = DB::table('program_user')
678
+    //  ->where('user_id', $user_id)
679
+    //  ->select('program_id')
680
+    //  ->get();
681
+    //$program_id = $program_id[0]->program_id;
662
 
682
 
663
     $objectives = DB::table('transformative_actions')
683
     $objectives = DB::table('transformative_actions')
664
       ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
684
       ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
667
       ->select('objectives.text as text', 'objectives.id as id')
687
       ->select('objectives.text as text', 'objectives.id as id')
668
       ->orderBy('objectives.text', 'ASC')
688
       ->orderBy('objectives.text', 'ASC')
669
       ->get();
689
       ->get();
690
+    $objective_ids = DB::table('transformative_actions')
691
+      ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
692
+      ->join('objectives', 'objectives.id', '=', 'transformative_objective.objective_id')
693
+      ->where('transformative_actions.id', $ta_id)
694
+      ->select('objectives.text as text', 'objectives.id as id')
695
+      ->orderBy('objectives.text', 'ASC')
696
+      ->lists('objectives.id');
670
     Log::info($ta_id);
697
     Log::info($ta_id);
671
 
698
 
672
-    $an_objective = $objectives[0]->id;
673
-    $outcome_id = DB::table('criterion_objective_outcome')
674
-      ->where('criterion_objective_outcome.objective_id', $an_objective)
675
-      ->select('criterion_objective_outcome.outcome_id')
676
-      ->get();
677
-    $outcome_id = $outcome_id[0]->outcome_id;
678
-
679
-
699
+    //$an_objective = $objectives[0]->id;
700
+    $outcome_ids = DB::table('objective_outcome')
701
+      ->whereIn('objective_outcome.objective_id', $objective_ids)
702
+      ->select('objective_outcome.outcome_id')
703
+      ->lists('outcome_id');
704
+    //$outcome_id = $outcome_id[0]->outcome_id;
705
+    Log::info("outcomes");
706
+    Log::info($outcome_ids);
680
     $objectives_from_outcome = DB::table('objectives')
707
     $objectives_from_outcome = DB::table('objectives')
681
       ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
708
       ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
682
-      ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'objectives.id')
683
-      ->where('criterion_objective_outcome.outcome_id', $outcome_id)
684
-      ->where('objective_program.program_id', $program_id)
709
+      ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
710
+      ->whereIn('objective_outcome.outcome_id', $outcome_ids)
711
+      ->whereIn('objective_program.program_id', $program_ids)
685
       ->orderBy('objectives.text', 'ASC')
712
       ->orderBy('objectives.text', 'ASC')
686
       ->select('objectives.text as text', 'objectives.id as id')
713
       ->select('objectives.text as text', 'objectives.id as id')
714
+      ->distinct()
687
       ->get();
715
       ->get();
716
+
688
     $selected_courses = DB::table('ta_course')
717
     $selected_courses = DB::table('ta_course')
689
       ->join('courses', function ($join) {
718
       ->join('courses', function ($join) {
690
         $join->on('courses.number', '=', 'ta_course.course_number');
719
         $join->on('courses.number', '=', 'ta_course.course_number');
731
   // load the available objectieves from an outcome when creating a Tranformative Action
760
   // load the available objectieves from an outcome when creating a Tranformative Action
732
   public function objectivesFromOutcome()
761
   public function objectivesFromOutcome()
733
   {
762
   {
734
-    $user_id = Auth::user()->id;
735
-    $program_id = DB::table('program_user')
736
-      ->where('user_id', $user_id)
737
-      ->select('program_id')
738
-      ->get();
739
-    $program_id = $program_id[0]->program_id;
763
+    $user_role = Auth::user()->role;
764
+
765
+
766
+    switch ($user_role) {
767
+      case 1:
768
+
769
+        $program_ids = DB::table('programs')->lists('id');
770
+        break;
771
+
772
+      case 2:
773
+        $user_school = Auth::user()->school_id;
774
+        $program_ids = DB::table('programs')
775
+          ->where('school_id', $user_school)
776
+          ->lists('id');
777
+        break;
778
+      case 3:
779
+        $user_id = Auth::user()->id;
780
+        $program_ids = DB::table('program_user')
781
+          ->where('user_id', $user_id)
782
+          ->select('program_id')
783
+          ->lists('program_id');
784
+        break;
785
+    }
786
+
787
+    //$program_id = DB::table('program_user')
788
+    //  ->where('user_id', $user_id)
789
+    //  ->select('program_id')
790
+    //  ->get();
791
+    //$program_id = $program_id[0]->program_id;
740
     $ta_id = Input::get("ta_id");
792
     $ta_id = Input::get("ta_id");
741
     $outcome_id = Input::get("outcome_id");
793
     $outcome_id = Input::get("outcome_id");
742
 
794
 
744
       ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
796
       ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
745
       ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
797
       ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
746
       ->where('objective_outcome.outcome_id', $outcome_id)
798
       ->where('objective_outcome.outcome_id', $outcome_id)
747
-      ->where('objective_program.program_id', $program_id)
799
+      ->whereIn('objective_program.program_id', $program_ids)
748
       ->orderBy('objectives.text', 'ASC')
800
       ->orderBy('objectives.text', 'ASC')
749
       ->select('objectives.text as text', 'objectives.id as id')
801
       ->select('objectives.text as text', 'objectives.id as id')
750
       ->get();
802
       ->get();
822
       if ($outcome_id == 0) {
874
       if ($outcome_id == 0) {
823
         $outcomes = DB::table('transformative_actions')
875
         $outcomes = DB::table('transformative_actions')
824
           ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
876
           ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
825
-          ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
826
-          ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
877
+          ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
878
+          ->join('outcomes', 'outcomes.id', '=', 'objective_outcome.outcome_id')
827
           ->where('transformative_actions.is_custom', 1)
879
           ->where('transformative_actions.is_custom', 1)
828
           ->where('transformative_actions.program_id', $program_id)
880
           ->where('transformative_actions.program_id', $program_id)
829
           ->where('transformative_actions.by_professor', 1)
881
           ->where('transformative_actions.by_professor', 1)
1001
       $filtered_at = DB::table('transformative_actions')
1053
       $filtered_at = DB::table('transformative_actions')
1002
         ->join('ta_course', 'ta_course.ta_id', '=', 'transformative_actions.id')
1054
         ->join('ta_course', 'ta_course.ta_id', '=', 'transformative_actions.id')
1003
         ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
1055
         ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
1004
-        ->join('criterion_objective_outcome', 'criterion_objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
1056
+        ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'transformative_objective.objective_id')
1005
         ->where('transformative_actions.user_id', Auth::user()->id)
1057
         ->where('transformative_actions.user_id', Auth::user()->id)
1006
         ->where('transformative_actions.is_custom', 1)
1058
         ->where('transformative_actions.is_custom', 1)
1007
         ->where('transformative_actions.program_id', $program_id)
1059
         ->where('transformative_actions.program_id', $program_id)
1008
         ->where('transformative_actions.by_professor', 1)
1060
         ->where('transformative_actions.by_professor', 1)
1009
-        ->whereIn('criterion_objective_outcome.outcome_id', $outcome_id)
1061
+        ->whereIn('objective_outcome.outcome_id', $outcome_id)
1010
         ->whereIn('ta_course.course_code', $course_id['code'])
1062
         ->whereIn('ta_course.course_code', $course_id['code'])
1011
         ->whereIn('ta_course.course_number', $course_id['number'])
1063
         ->whereIn('ta_course.course_number', $course_id['number'])
1012
         ->select('transformative_actions.*')
1064
         ->select('transformative_actions.*')

+ 12
- 4
app/models/Activity.php View File

38
     $activity_criterion = DB::table('activity_criterion')
38
     $activity_criterion = DB::table('activity_criterion')
39
       ->where('activity_id', '=', $this->id)
39
       ->where('activity_id', '=', $this->id)
40
       ->get();
40
       ->get();
41
+    Log::info('activity_criterion');
42
+    Log::info($activity_criterion);
43
+
41
     $criteria_achieved = [];
44
     $criteria_achieved = [];
42
     foreach ($activity_criterion as $index => $single_ac) {
45
     foreach ($activity_criterion as $index => $single_ac) {
43
 
46
 
47
+
44
       $assessments_passed = count(DB::table('assessments')
48
       $assessments_passed = count(DB::table('assessments')
45
         ->where('score', '>=', $this->rubric[0]->expected_points)
49
         ->where('score', '>=', $this->rubric[0]->expected_points)
46
         ->where('activity_criterion_id', '=', $single_ac->id)
50
         ->where('activity_criterion_id', '=', $single_ac->id)
49
         ->where('activity_criterion_id', '=', $single_ac->id)
53
         ->where('activity_criterion_id', '=', $single_ac->id)
50
         ->lists('student_id'));
54
         ->lists('student_id'));
51
 
55
 
52
-      if ((($assessments_passed / $assessments_attempted) * 100) >= $this->rubric[0]->expected_percentage) {
56
+      if ($assessments_attempted != 0 && (($assessments_passed / $assessments_attempted) * 100) >= $this->rubric[0]->expected_percentage) {
53
         $criteria_achieved[$single_ac->criterion_id] = 1;
57
         $criteria_achieved[$single_ac->criterion_id] = 1;
54
       } else {
58
       } else {
55
         $criteria_achieved[$single_ac->criterion_id] = 0;
59
         $criteria_achieved[$single_ac->criterion_id] = 0;
68
 
72
 
69
     $criterias = DB::table('criteria')
73
     $criterias = DB::table('criteria')
70
       ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
74
       ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
75
+      ->join('assessments', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
71
       ->where('activity_criterion.activity_id', '=', $this->id)
76
       ->where('activity_criterion.activity_id', '=', $this->id)
72
       ->select(
77
       ->select(
73
-        'activity_criterion.id as id',
74
-        'activity_criterion.criterion_id as criterion_id',
75
-        'activity_criterion.activity_id as activity_id'
78
+        array(
79
+          'activity_criterion.id as id',
80
+          'activity_criterion.criterion_id as criterion_id',
81
+          'activity_criterion.activity_id as activity_id'
82
+        )
76
       )
83
       )
77
       ->addSelect('criteria.name', 'criteria.subcriteria')
84
       ->addSelect('criteria.name', 'criteria.subcriteria')
78
       ->get();
85
       ->get();
104
         ->lists('student_id'));
111
         ->lists('student_id'));
105
       Log::info($amount_of_students_passed);
112
       Log::info($amount_of_students_passed);
106
       Log::info('es aqui');
113
       Log::info('es aqui');
114
+
107
       $single_crit->score_percentage = ($amount_of_students_passed / $amount_of_students) * 100;
115
       $single_crit->score_percentage = ($amount_of_students_passed / $amount_of_students) * 100;
108
       $criteria_achieved_percentage[$single_crit->criterion_id] = $single_crit;
116
       $criteria_achieved_percentage[$single_crit->criterion_id] = $single_crit;
109
       Log::info("?");
117
       Log::info("?");

+ 99
- 101
app/models/Program.php View File

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

+ 5
- 3
app/views/global/view-three-year-plan.blade.php View File

117
         {{ Form::open(array('action' => 'ThreeYearPlanController@create' )) }}
117
         {{ Form::open(array('action' => 'ThreeYearPlanController@create' )) }}
118
         <p>Select a new cycle. You cannot choose a cycle that has been created before</p>
118
         <p>Select a new cycle. You cannot choose a cycle that has been created before</p>
119
         <select name = 'years' class="form-control selectpicker">
119
         <select name = 'years' class="form-control selectpicker">
120
-          @for ($i = (int)$last_year; $i<2100; $i++)
121
           
120
           
122
-          <option value='{{$i}}' >{{$i}} - {{$i+3}} </option>
123
-          @endfor
121
+          
122
+          <option value='{{$last_year}}' >{{$last_year}} - {{$last_year+3}} </option>
123
+          <option value='{{$last_year+3}}' >{{$last_year+3}} - {{$last_year+6}} </option>
124
+          
125
+          
124
       </select>
126
       </select>
125
       </div>
127
       </div>
126
       <div class="modal-footer">
128
       <div class="modal-footer">

+ 4
- 0
app/views/local/managers/admins/objectives.blade.php View File

105
                         @endforeach
105
                         @endforeach
106
                     </select>
106
                     </select>
107
                 </div>
107
                 </div>
108
+                <hr>
108
 
109
 
109
                 <!-- Associated Outcome -->
110
                 <!-- Associated Outcome -->
110
 
111
 
115
                         {{ Form::select('outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome0']) }}
116
                         {{ Form::select('outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome0']) }}
116
 
117
 
117
                     </div>
118
                     </div>
119
+                    
118
                 </div>
120
                 </div>
121
+                
122
+                
119
                 <button id='button-add-assoc-outcome' class='btn btn-md btn-secondary' onclick='addAssoc()'>
123
                 <button id='button-add-assoc-outcome' class='btn btn-md btn-secondary' onclick='addAssoc()'>
120
                     <span class='glyphicon glyphicon-plus'>
124
                     <span class='glyphicon glyphicon-plus'>
121
 
125
 

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

325
                 <div class="form-group col-md-11 editCourse">
325
                 <div class="form-group col-md-11 editCourse">
326
                   <select name="courseid" id = "edit_course" class="form-control selectpicker">
326
                   <select name="courseid" id = "edit_course" class="form-control selectpicker">
327
                     @foreach ($courses_create as $course)
327
                     @foreach ($courses_create as $course)
328
-                      <option value="({{$course->code}},{{$course->number}})">{{$course->code}}[{{$course->code}}]</option>
328
+                      <option value="({{$course->code}},{{$course->number}})">{{$course->code}} {{$course->number}}</option>
329
                     @endforeach
329
                     @endforeach
330
                   </select>
330
                   </select>
331
                 </div>
331
                 </div>

+ 43
- 18
app/views/local/managers/pCoords/assessment_report.blade.php View File

31
                                     {{ $program->school->name }}: {{ $program->name }}
31
                                     {{ $program->school->name }}: {{ $program->name }}
32
                                 </h4>
32
                                 </h4>
33
                             </th>
33
                             </th>
34
-                        </tr>
34
+                        </tr> 
35
                     </thead>
35
                     </thead>
36
                     <tbody>
36
                     <tbody>
37
                         @if($program->assessesOutcome($outcome->id))
37
                         @if($program->assessesOutcome($outcome->id))
41
 
41
 
42
                                     <?php
42
                                     <?php
43
 
43
 
44
-                                        $sections_evaluating = Course::has('activities')
44
+                                        /*$sections_evaluating = Course::has('activities')
45
                                         ->whereNotNull('outcomes_attempted')
45
                                         ->whereNotNull('outcomes_attempted')
46
                                         ->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'')
46
                                         ->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'')
47
                                         ->with(array('activities'=>function($query) use(&$outcome){
47
                                         ->with(array('activities'=>function($query) use(&$outcome){
49
                                             $query->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'');} ))
49
                                             $query->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'');} ))
50
                                         ->where('code', $course->code)->where('number',$course->number)
50
                                         ->where('code', $course->code)->where('number',$course->number)
51
                                         ->whereIn('semester_id', Session::get('semesters_ids'))
51
                                         ->whereIn('semester_id', Session::get('semesters_ids'))
52
-                                        ->get();
52
+                                        ->get();*/
53
+
54
+
55
+                                        $sections_evaluating = Course::has('activities')
56
+                            
57
+                            //->whereNotNull('outcomes_attempted')
58
+                            //->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'')
59
+                            ->with(array('activities'=>function($query) use(&$outcome, &$course){
60
+                                $activities = DB::table('activities')
61
+                                ->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
62
+                                ->join('assessments', 'assessments.activity_criterion_id', '=','activity_criterion.id')
63
+                                ->join('criterion_objective_outcome', 'activity_criterion.criterion_id', '=', 'criterion_objective_outcome.criterion_id')
64
+                                ->where('course_id', $course->id)
65
+                                ->where('criterion_objective_outcome.outcome_id', $outcome->id)
66
+                                ->select('activity_id')
67
+                                ->lists('activity_id');
68
+
69
+                                //$query->whereNotNull('outcomes_attempted');
70
+                                //$query->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'');
71
+                            $query->whereIn('id', $activities);
72
+                        } ))
73
+                                
74
+
75
+                            ->where('code', $course->code)->where('number',$course->number)
76
+                            ->whereIn('semester_id', Session::get('semesters_ids'))
77
+                            ->get();
78
+                            
79
+                            
53
                                     ?>
80
                                     ?>
54
 
81
 
55
                                     @if(count($sections_evaluating))
82
                                     @if(count($sections_evaluating))
66
                                                 @foreach($section->activities as $index4 => $activity)
93
                                                 @foreach($section->activities as $index4 => $activity)
67
 
94
 
68
                                                     <!-- If activity has a rubric and the rubric has the outcome being evaluated -->
95
                                                     <!-- If activity has a rubric and the rubric has the outcome being evaluated -->
69
-                                                    @if(array_key_exists($outcome->id, (array)$activity->o_att_array) && $activity->o_att_array[$outcome->id] >=1)
96
+                                                    @if($activity->draft ==0 && array_key_exists($outcome->id, (array)$activity->o_att_array) && $activity->o_att_array[$outcome->id] >=1)
70
                                                         <h5>Measure {{ $index4 + 1 }}</h5>
97
                                                         <h5>Measure {{ $index4 + 1 }}</h5>
71
                                                         <p>A rubric was used in the {{ $section->code }}-{{ $section->number }} ({{ $section->name }}) course ({{ date('M Y', strtotime($course->updated_at))}}) to assess students’ <u>{{ strtolower($outcome->name) }}</u> in the activity: "<strong>{{ $activity->name }}</strong>". N= {{ count($section->students) }}. </p>
98
                                                         <p>A rubric was used in the {{ $section->code }}-{{ $section->number }} ({{ $section->name }}) course ({{ date('M Y', strtotime($course->updated_at))}}) to assess students’ <u>{{ strtolower($outcome->name) }}</u> in the activity: "<strong>{{ $activity->name }}</strong>". N= {{ count($section->students) }}. </p>
72
-                                                        <p>The expected performance level was that <strong>{{ $activity->rubric->expected_percentage }}%</strong> of students participating in the activity would score <strong>{{ $activity->rubric->expected_points }} points</strong> or more in the 1-8 point scale used.</p>
99
+                                                        <p>The expected performance level was that <strong>{{ $activity->rubric[0]->expected_percentage }}%</strong> of students participating in the activity would score <strong>{{ $activity->rubric[0]->expected_points }} points</strong> or more in the 1-8 point scale used.</p>
73
                                                         <p>The results for each criterion were as follows:</p>
100
                                                         <p>The results for each criterion were as follows:</p>
74
 
101
 
75
                                                         <table class="table table-condensed table-bordered">
102
                                                         <table class="table table-condensed table-bordered">
76
-                                                            @foreach((array)$activity->cap_array as $index5 => $cap)
77
-                                                                <?php
78
-                                                                    $criterion = Criterion::find($index5);
79
-                                                                ?>
80
-
81
-                                                                @if($criterion['outcome_id'] == $outcome->id && $cap >= $activity->rubric->expected_percentage )
103
+                                                            @foreach((array)$activity->cap_array as $criterion_id => $criterion)
104
+                                                                @if(in_array($outcome->id, json_decode($criterion->outcome_id))  /*== $outcome->id*/ && $criterion->score_percentage >= $activity->rubric[0]->expected_percentage )
82
                                                                     <tr>
105
                                                                     <tr>
83
-                                                                        <td>{{ $criterion['name'] }}</td>
84
-                                                                        <td class="col-md-1 success">{{ $cap }}%</td>
106
+                                                                        <td>{{ $criterion->name }}</td>
107
+                                                                        <td class="col-md-1 success">{{ $criterion->score_percentage }}%</td>
85
                                                                     </tr>
108
                                                                     </tr>
86
-                                                                @elseif($criterion['outcome_id'] == $outcome->id && $cap < $activity->rubric->expected_percentage )
109
+                                                                @elseif(in_array($outcome->id, json_decode($criterion->outcome_id)) && $criterion->score_percentage < $activity->rubric[0]->expected_percentage )
87
                                                                     <tr>
110
                                                                     <tr>
88
-                                                                        <td>{{ $criterion['name'] }}</td>
89
-                                                                        <td class="col-md-1 danger">{{ $cap }}%</td>
111
+                                                                        <td>{{ $criterion->name }}</td>
112
+                                                                        <td class="col-md-1 danger">{{ $criterion->score_percentage }}%</td>
90
                                                                     </tr>
113
                                                                     </tr>
91
-                                                                @endif
114
+                                                                @endif  
92
                                                             @endforeach
115
                                                             @endforeach
93
                                                         </table>
116
                                                         </table>
94
 
117
 
121
                                                         @endif
144
                                                         @endif
122
                                                         <br><br>
145
                                                         <br><br>
123
 
146
 
124
-                                                    @else
147
+                                                    @elseif($activity->draft ==0)
125
                                                         <h5>Measure {{ $index4 + 1 }}</h5>
148
                                                         <h5>Measure {{ $index4 + 1 }}</h5>
126
                                                         <em>Outcome not measured.</em>
149
                                                         <em>Outcome not measured.</em>
150
+                                                    @else
151
+                                                    
127
                                                     @endif
152
                                                     @endif
128
                                                 @endforeach
153
                                                 @endforeach
129
                                             @endforeach
154
                                             @endforeach

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

65
             <div class="panel-heading">
65
             <div class="panel-heading">
66
                 Edit
66
                 Edit
67
             </div>
67
             </div>
68
-            <button class="btn btn-md btn-secondary filterButton">
68
+            
69
+
70
+            <div class="panel-body">
71
+                <button class="btn btn-md btn-secondary filterButton">
69
                 <span class="glyphicon glyphicon-plus">
72
                 <span class="glyphicon glyphicon-plus">
70
                 </span>
73
                 </span>
71
                 Filters
74
                 Filters
72
               </button>
75
               </button>
73
-            <div class="panel-body">
74
                 <div class='filterSection'>
76
                 <div class='filterSection'>
75
             
77
             
76
                     {{ Form::open(array('action' => 'Objective2Controller@update')) }}
78
                     {{ Form::open(array('action' => 'Objective2Controller@update')) }}
89
     
91
     
90
                     </div>
92
                     </div>
91
                       </div>
93
                       </div>
94
+                      <hr>
92
 
95
 
93
                 <div class="form-group">
96
                 <div class="form-group">
94
                     {{ Form::label('objective_id', 'Objectives') }}
97
                     {{ Form::label('objective_id', 'Objectives') }}
115
                         <label>Associated Outcome</label>
118
                         <label>Associated Outcome</label>
116
 
119
 
117
                         {{ Form::select("assoc_outcome[]", $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome0']) }}
120
                         {{ Form::select("assoc_outcome[]", $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome0']) }}
118
-
121
+<br><br>
119
                     </div>
122
                     </div>
123
+                    
120
                 </div>
124
                 </div>
125
+                
121
                 <button id='button-add-assoc-outcome' class='btn btn-md btn-secondary' onclick='addAssoc()'>
126
                 <button id='button-add-assoc-outcome' class='btn btn-md btn-secondary' onclick='addAssoc()'>
122
                     <span class='glyphicon glyphicon-plus'>
127
                     <span class='glyphicon glyphicon-plus'>
123
 
128
 
432
 
437
 
433
     function deleteLastAssoc() {
438
     function deleteLastAssoc() {
434
 
439
 
435
-        div = document.getElementById('assocOutcomeForm' + (counterAssoc).toString());
440
+        div = document.getElementById('assocOutcomeForm' + (i).toString());
436
         div.remove();
441
         div.remove();
437
-        button = document.getElementById('closeAssoc' + (counterAssoc).toString());
442
+        button = document.getElementById('closeAssoc' + (i).toString());
438
         button.remove();
443
         button.remove();
439
         counterAssoc -= 1;
444
         counterAssoc -= 1;
440
 
445
 

+ 4
- 4
app/views/local/managers/sCoords/annual-plans.blade.php View File

180
             var $button = $('<button/>', {
180
             var $button = $('<button/>', {
181
             'type': 'button',
181
             'type': 'button',
182
             'class': 'btn btn-secondary',
182
             'class': 'btn btn-secondary',
183
-            'onclick': 'addCriteriaTest("forObjective-'+objectives[objective].id+"-course-"+courses[objectives[objective].id][course].id+'", "'+objectives[objective].id+"-course-"+courses[objectives[objective].id][course].id+'", '+courses[objectives[objective].id][course].typ_course_id+', null, "'+options+'")'
183
+            'onclick': 'addCriteriaTest("forObjective-'+objectives[objective].id+"-course-"+courses[objectives[objective].id][course].typ_course_id+'", "'+objectives[objective].id+"-course-"+courses[objectives[objective].id][course].typ_course_id+'", '+courses[objectives[objective].id][course].typ_course_id+', null, "'+options+'")'
184
             });
184
             });
185
            
185
            
186
             $button.append("+ Add criteria");
186
             $button.append("+ Add criteria");
485
   }).html('x');
485
   }).html('x');
486
   $div.append($span);
486
   $div.append($span);
487
  $div.append("<br><br>")
487
  $div.append("<br><br>")
488
- $("#forObjective-"+new_id_for_select).append("<br>");
489
-  $div.appendTo($("#forObjective-"+new_id_for_select));
488
+ $('#'+div).append("<br>");
489
+  $div.appendTo($("#"+div));
490
   
490
   
491
 
491
 
492
   
492
   
495
   
495
   
496
 
496
 
497
  
497
  
498
-  $("#forObjective-"+new_id_for_select).data("amount-select", amount_select+1);
498
+  $("#"+div).data("amount-select", amount_select+1);
499
 
499
 
500
 }
500
 }
501
 $('#allOutcomes').hide();
501
 $('#allOutcomes').hide();

+ 5
- 2
app/views/local/managers/sCoords/objectives.blade.php View File

65
             <div class="panel-heading">
65
             <div class="panel-heading">
66
                 Edit
66
                 Edit
67
             </div>
67
             </div>
68
-            <button class="btn btn-md btn-secondary filterButton">
68
+            
69
+              <div class="panel-body">
70
+                  <button class="btn btn-md btn-secondary filterButton">
69
                 <span class="glyphicon glyphicon-plus">
71
                 <span class="glyphicon glyphicon-plus">
70
                 </span>
72
                 </span>
71
                 Filters
73
                 Filters
72
               </button>
74
               </button>
73
-              <div class="panel-body">
74
               <div class='filterSection'>
75
               <div class='filterSection'>
75
             
76
             
76
                 {{ Form::open(array('action' => 'Objective2Controller@update')) }}
77
                 {{ Form::open(array('action' => 'Objective2Controller@update')) }}
89
 
90
 
90
                 </div>
91
                 </div>
91
                   </div>
92
                   </div>
93
+                  <hr>
92
                 <div class="form-group">
94
                 <div class="form-group">
93
                     {{ Form::label('objective_id', 'Objectives') }}
95
                     {{ Form::label('objective_id', 'Objectives') }}
94
                     <select id="select-objective" name="id" class="form-control selectpicker">
96
                     <select id="select-objective" name="id" class="form-control selectpicker">
107
                     </select>
109
                     </select>
108
                 </div>
110
                 </div>
109
 
111
 
112
+
110
                 <!-- Associated Outcome -->
113
                 <!-- Associated Outcome -->
111
 
114
 
112
                 <div class="form-group">
115
                 <div class="form-group">

+ 14
- 4
app/views/local/managers/shared/rubrics.blade.php View File

203
                 </div>
203
                 </div>
204
                 <div class="form-group">
204
                 <div class="form-group">
205
                     <label>Select an Objective</label>
205
                     <label>Select an Objective</label>
206
-                    <select id="select-objective" class="form-control selectpicker" onchange="fetchCriteria($('#select-outcome'), $(this))">
206
+                    <select id="select-objective" class="form-control selectpicker" >
207
                         
207
                         
208
                     </select>
208
                     </select>
209
                 </div>
209
                 </div>
224
                 </div>
224
                 </div>
225
                 <div class="form-group">
225
                 <div class="form-group">
226
                     <label>Select the Type of Rubric</label>
226
                     <label>Select the Type of Rubric</label>
227
-                <select id="number_of_scales" class="form-control selectpicker" onchange ="fetchCriteria($('#select-outcome'), $('#select-objective'))">
227
+                <select id="number_of_scales" class="form-control selectpicker" >
228
                     @for($i = 1; $i <= 20; $i++)
228
                     @for($i = 1; $i <= 20; $i++)
229
                     @if(8%$i == 0)
229
                     @if(8%$i == 0)
230
                     @if($i==1)
230
                     @if($i==1)
316
     </div>
316
     </div>
317
 </div>
317
 </div>
318
 <script>
318
 <script>
319
-  
319
+
320
     </script>
320
     </script>
321
 @stop
321
 @stop
322
 
322
 
355
     );
355
     );
356
 
356
 
357
 }
357
 }
358
-// Fetch criteria associated to a specific learning outcome
358
+// Fetch criteria associated to a specific learning outcome 
359
+
359
 function fetchCriteria(outcome, objective)
360
 function fetchCriteria(outcome, objective)
360
 {
361
 {
361
     amount_of_scales = parseInt($('#number_of_scales').find(':selected').val());
362
     amount_of_scales = parseInt($('#number_of_scales').find(':selected').val());
995
     $(this).siblings('.panel-body').stop().slideToggle();
996
     $(this).siblings('.panel-body').stop().slideToggle();
996
 });
997
 });
997
 
998
 
999
+// Fetch criteria everytime something changes 
1000
+$('#select-objective').on('change', function(){
1001
+    fetchCriteria($('#select-outcome'), $('#select-objective'));
1002
+})
1003
+
1004
+$("#number_of_scales").on('change', function(){
1005
+    fetchCriteria($('#select-outcome'), $('#select-objective'));
1006
+})
1007
+
998
 
1008
 
999
 // When trying to change the template, ask the user to confirm and reset the
1009
 // When trying to change the template, ask the user to confirm and reset the
1000
 // rubric if s/he does
1010
 // rubric if s/he does

+ 8
- 4
app/views/local/professors/assessment_report.blade.php View File

81
 Log::info("this is the cap_array for ". $activity->name);
81
 Log::info("this is the cap_array for ". $activity->name);
82
 Log::info($activity->cap_array);
82
 Log::info($activity->cap_array);
83
 Log::info('aqui papi');?>
83
 Log::info('aqui papi');?>
84
-                                        <!-- If activity has a rubric and the rubric has the outcome being evaluated -->
85
-                                        @if(array_key_exists($outcome->id, (array)$activity->o_att_array))
84
+
85
+                                        <!-- If activity is not draft, has a rubric and the rubric has the outcome being evaluated -->
86
+                                        @if($activity->draft ==0 && array_key_exists($outcome->id, (array)$activity->o_att_array))
86
                                             <h5>Measure {{ $index4 + 1 }}</h5>
87
                                             <h5>Measure {{ $index4 + 1 }}</h5>
87
                                             <p>A rubric was used in the {{ $section->code }}-{{ $section->number }} ({{ $section->name }}) course ({{ date('M Y', strtotime($course->updated_at))}}) to assess students’ <u>{{ strtolower($outcome->name) }}</u> in the activity: "<strong>{{ $activity->name }}</strong>". At the time of assessment there were {{ $activity->amount_of_assessed_students() }} students in the section.</p>
88
                                             <p>A rubric was used in the {{ $section->code }}-{{ $section->number }} ({{ $section->name }}) course ({{ date('M Y', strtotime($course->updated_at))}}) to assess students’ <u>{{ strtolower($outcome->name) }}</u> in the activity: "<strong>{{ $activity->name }}</strong>". At the time of assessment there were {{ $activity->amount_of_assessed_students() }} students in the section.</p>
88
                                             <p>The expected performance level was that <strong>{{ $activity->rubric[0]->expected_percentage }}%</strong> of students participating in the activity would score <strong>{{ $activity->rubric[0]->expected_points }} points</strong>  or more in the 1-{{$activity->rubric[0]->max_score}} point scale used.</p>
89
                                             <p>The expected performance level was that <strong>{{ $activity->rubric[0]->expected_percentage }}%</strong> of students participating in the activity would score <strong>{{ $activity->rubric[0]->expected_points }} points</strong>  or more in the 1-{{$activity->rubric[0]->max_score}} point scale used.</p>
140
                                                 None
141
                                                 None
141
                                             @endif
142
                                             @endif
142
 
143
 
143
-                                        @else
144
+                                        @elseif ($activity->draft == 0)
144
                                             <h5>Measure {{ $index4 + 1 }}</h5>
145
                                             <h5>Measure {{ $index4 + 1 }}</h5>
145
                                             <em>Outcome not measured.</em>
146
                                             <em>Outcome not measured.</em>
146
-                                        @endif
147
+                                        @else
148
+                                        
149
+                                            @endif
150
+
147
                                     @endforeach
151
                                     @endforeach
148
                                 @endforeach
152
                                 @endforeach
149
                                 </td>
153
                                 </td>

+ 7
- 5
app/views/local/professors/print_assessment.blade.php View File

120
                         <th>Student</th>
120
                         <th>Student</th>
121
                         @foreach ($rubric_contents as $index=>$criterion)
121
                         @foreach ($rubric_contents as $index=>$criterion)
122
                             <th class="criterion-field" data-criterion-id="{{{ $criterion->criterion_id }}}">{{ $criterion->name}}</th>
122
                             <th class="criterion-field" data-criterion-id="{{{ $criterion->criterion_id }}}">{{ $criterion->name}}</th>
123
-                            <input type="hidden" id="weight-{{$index}}" val = "{{$criterion->weight}}">
123
+                            <input type="hidden" id="weight-{{$index}}" value = "{{$criterion->weight}}">
124
                         @endforeach
124
                         @endforeach
125
                         <th>Student Percentage</th>
125
                         <th>Student Percentage</th>
126
                         <th>Student % per Weight<th>
126
                         <th>Student % per Weight<th>
141
                         <!-- For each criterion in the rubric, there's a score field -->
141
                         <!-- For each criterion in the rubric, there's a score field -->
142
                         @for ($i = 0; $i<sizeof($rubric_contents); $i++)
142
                         @for ($i = 0; $i<sizeof($rubric_contents); $i++)
143
                             <td class="score-field">
143
                             <td class="score-field">
144
-                                @if(array_key_exists($student->id, $scores_array)&& isset($scores_array[$student->id][$i]))
145
-                                {{ $scores_array[$student->id][$i] }}
144
+                                @if(array_key_exists($student->id, $scores_array)&& isset($scores_array[$student->id][$rubric_contents[$i]->activity_criterion_id]))
145
+                                {{ $scores_array[$student->id][$rubric_contents[$i]->activity_criterion_id] }}
146
                                 @else
146
                                 @else
147
                                 N/A
147
                                 N/A
148
                                 @endif
148
                                 @endif
172
 </div>
172
 </div>
173
 
173
 
174
 
174
 
175
-<?
175
+<?php
176
 
176
 
177
 echo '</body>';
177
 echo '</body>';
178
 echo '</html>';
178
 echo '</html>';
257
             {
257
             {
258
                 sum += val;
258
                 sum += val;
259
                 total+=1;
259
                 total+=1;
260
+              
261
+
260
                 per_of_weight += val * parseInt($('#weight-'+index).val()); 
262
                 per_of_weight += val * parseInt($('#weight-'+index).val()); 
261
             sum_of_weight += parseInt($('#weight-'+index).val());
263
             sum_of_weight += parseInt($('#weight-'+index).val());
262
             }
264
             }
272
         percentage_per_weight ="0.00";
274
         percentage_per_weight ="0.00";
273
 
275
 
274
         row.find('.percentage').html('<strong>'+percentage+'%</strong>');
276
         row.find('.percentage').html('<strong>'+percentage+'%</strong>');
275
-        row.find('.percentage-per-weight').html('<strong>'+percentage+'%</strong>');
277
+        row.find('.percentage-per-weight').html('<strong>'+percentage_per_weight+'%</strong>');
276
 
278
 
277
     }
279
     }
278
   });
280
   });

+ 2
- 2
app/views/local/professors/view_assessment.blade.php View File

99
                     <!-- For each criterion in the rubric, there's a score field -->
99
                     <!-- For each criterion in the rubric, there's a score field -->
100
                     @for ($i = 0; $i<sizeof($rubric_criterion); $i++)
100
                     @for ($i = 0; $i<sizeof($rubric_criterion); $i++)
101
                         <td class="score-field text-center">
101
                         <td class="score-field text-center">
102
-                            @if(array_key_exists($student->id, $scores_array) && isset($scores_array[$student->id][$i]))
103
-                            {{$scores_array[$student->id][$i]}}
102
+                            @if(array_key_exists($student->id, $scores_array) && isset($scores_array[$student->id][$rubric_criterion[$i]->activity_criterion_id]))
103
+                            {{$scores_array[$student->id][$rubric_criterion[$i]->activity_criterion_id]}}
104
                             @else
104
                             @else
105
                             N/A
105
                             N/A
106
                             @endif
106
                             @endif