Browse Source

final push

parent
commit
11011a01c3

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

@@ -819,7 +819,7 @@ class ActivitiesController extends \BaseController
819 819
         $scores_array = array();
820 820
 
821 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 823
             $scores_array[$assessment->student_id]['comments'] = DB::table('activity_student')->where('student_id', '=', $assessment->student_id)
824 824
                 ->where("activity_id", '=', $activity->id)
825 825
                 ->select('comments')->first()->comments;
@@ -858,7 +858,7 @@ class ActivitiesController extends \BaseController
858 858
             ->addSelect('rubric_criterion.rubric_id', 'rubric_criterion.id as rubric_criterion_id')
859 859
             ->get();
860 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 862
             ->where('rubric_id', $rubric->id)
863 863
             ->orderBy("position", 'ASC')
864 864
             ->lists('text');
@@ -895,7 +895,7 @@ class ActivitiesController extends \BaseController
895 895
 
896 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 899
             $scores_array[$assessment->student_id]['comments'] = DB::table('activity_student')->where('student_id', '=', $assessment->student_id)
900 900
                 ->where("activity_id", '=', $activity->id)
901 901
                 ->select('comments')->first()->comments;

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

@@ -212,7 +212,7 @@ class AnnualPlansController extends \BaseController
212 212
 
213 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 216
       Log::info($typ_info['criteria'][$objective->id]);
217 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 218
       Log::info($typ_info['typ_objective_id'][$objective->id]);
@@ -346,7 +346,7 @@ class AnnualPlansController extends \BaseController
346 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 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 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 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,11 +794,13 @@ class OutcomesController extends \BaseController
794 794
             ->with(array('courses' => function ($query) {
795 795
                 $query
796 796
                     ->has('activities')
797
-                    ->whereNotNull('outcomes_attempted')
797
+                    //->whereNotNull('outcomes_attempted')
798
+
798 799
                     ->whereIn('semester_id', Session::get('semesters_ids'))
799 800
                     ->groupBy(array('code', 'number'));
800 801
             }))
801 802
             ->first();
803
+        Log::info($program);
802 804
 
803 805
         return View::make('local.managers.pCoords.assessment_report', compact('title', 'outcome', 'program'));
804 806
     }
@@ -810,9 +812,11 @@ class OutcomesController extends \BaseController
810 812
         $semesters = DB::table('semesters')->whereIn('id', $semesters)->orderBy('start', 'ASC')->first();
811 813
         Log::info($semesters->start);
812 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 817
             ->orderBy('name', 'ASC')->get();
818
+
819
+        Log::info($outcomes);
816 820
         $title = "My Courses' Assessment Reports";
817 821
 
818 822
         return View::make('local.professors.assessment_reports', compact('title', 'outcomes'));

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

@@ -259,6 +259,7 @@ class RubricsController extends \BaseController
259 259
         Log::info('entré6???');
260 260
         DB::delete("delete from rubric_criterion where rubric_id ={$rubric->id}");
261 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 263
         foreach ($criteria as $index => $criterion_id) {
263 264
 
264 265
 

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

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

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

@@ -121,8 +121,8 @@ class TransformativeActionsController extends \BaseController
121 121
         ->get();
122 122
       $outcome_filter_editPanel = DB::table('transformative_actions')
123 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 126
         ->where('transformative_actions.is_custom', 1)
127 127
         ->where('transformative_actions.program_id', $program_id)
128 128
         ->where('transformative_actions.by_professor', 0)
@@ -523,7 +523,7 @@ class TransformativeActionsController extends \BaseController
523 523
             array(
524 524
               'ta_id' => $ta_id,
525 525
               'objective_id' => $new_id,
526
-              'created_at' => $current_timestamp,
526
+              // 'created_at' => $current_timestamp,
527 527
             )
528 528
           );
529 529
         } else {
@@ -653,12 +653,32 @@ class TransformativeActionsController extends \BaseController
653 653
   public function selectTA()
654 654
   {
655 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 683
     $objectives = DB::table('transformative_actions')
664 684
       ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
@@ -667,24 +687,33 @@ class TransformativeActionsController extends \BaseController
667 687
       ->select('objectives.text as text', 'objectives.id as id')
668 688
       ->orderBy('objectives.text', 'ASC')
669 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 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 707
     $objectives_from_outcome = DB::table('objectives')
681 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 712
       ->orderBy('objectives.text', 'ASC')
686 713
       ->select('objectives.text as text', 'objectives.id as id')
714
+      ->distinct()
687 715
       ->get();
716
+
688 717
     $selected_courses = DB::table('ta_course')
689 718
       ->join('courses', function ($join) {
690 719
         $join->on('courses.number', '=', 'ta_course.course_number');
@@ -731,12 +760,35 @@ class TransformativeActionsController extends \BaseController
731 760
   // load the available objectieves from an outcome when creating a Tranformative Action
732 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 792
     $ta_id = Input::get("ta_id");
741 793
     $outcome_id = Input::get("outcome_id");
742 794
 
@@ -744,7 +796,7 @@ class TransformativeActionsController extends \BaseController
744 796
       ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
745 797
       ->join('objective_outcome', 'objective_outcome.objective_id', '=', 'objectives.id')
746 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 800
       ->orderBy('objectives.text', 'ASC')
749 801
       ->select('objectives.text as text', 'objectives.id as id')
750 802
       ->get();
@@ -822,8 +874,8 @@ class TransformativeActionsController extends \BaseController
822 874
       if ($outcome_id == 0) {
823 875
         $outcomes = DB::table('transformative_actions')
824 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 879
           ->where('transformative_actions.is_custom', 1)
828 880
           ->where('transformative_actions.program_id', $program_id)
829 881
           ->where('transformative_actions.by_professor', 1)
@@ -1001,12 +1053,12 @@ class TransformativeActionsController extends \BaseController
1001 1053
       $filtered_at = DB::table('transformative_actions')
1002 1054
         ->join('ta_course', 'ta_course.ta_id', '=', 'transformative_actions.id')
1003 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 1057
         ->where('transformative_actions.user_id', Auth::user()->id)
1006 1058
         ->where('transformative_actions.is_custom', 1)
1007 1059
         ->where('transformative_actions.program_id', $program_id)
1008 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 1062
         ->whereIn('ta_course.course_code', $course_id['code'])
1011 1063
         ->whereIn('ta_course.course_number', $course_id['number'])
1012 1064
         ->select('transformative_actions.*')

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

@@ -38,9 +38,13 @@ class Activity extends Eloquent
38 38
     $activity_criterion = DB::table('activity_criterion')
39 39
       ->where('activity_id', '=', $this->id)
40 40
       ->get();
41
+    Log::info('activity_criterion');
42
+    Log::info($activity_criterion);
43
+
41 44
     $criteria_achieved = [];
42 45
     foreach ($activity_criterion as $index => $single_ac) {
43 46
 
47
+
44 48
       $assessments_passed = count(DB::table('assessments')
45 49
         ->where('score', '>=', $this->rubric[0]->expected_points)
46 50
         ->where('activity_criterion_id', '=', $single_ac->id)
@@ -49,7 +53,7 @@ class Activity extends Eloquent
49 53
         ->where('activity_criterion_id', '=', $single_ac->id)
50 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 57
         $criteria_achieved[$single_ac->criterion_id] = 1;
54 58
       } else {
55 59
         $criteria_achieved[$single_ac->criterion_id] = 0;
@@ -68,11 +72,14 @@ class Activity extends Eloquent
68 72
 
69 73
     $criterias = DB::table('criteria')
70 74
       ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criteria.id')
75
+      ->join('assessments', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
71 76
       ->where('activity_criterion.activity_id', '=', $this->id)
72 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 84
       ->addSelect('criteria.name', 'criteria.subcriteria')
78 85
       ->get();
@@ -104,6 +111,7 @@ class Activity extends Eloquent
104 111
         ->lists('student_id'));
105 112
       Log::info($amount_of_students_passed);
106 113
       Log::info('es aqui');
114
+
107 115
       $single_crit->score_percentage = ($amount_of_students_passed / $amount_of_students) * 100;
108 116
       $criteria_achieved_percentage[$single_crit->criterion_id] = $single_crit;
109 117
       Log::info("?");

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

@@ -39,13 +39,21 @@ class Program extends Eloquent
39 39
 
40 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 48
 	public function assessesOutcome($outcome_id)
46 49
 	{
47 50
 
48 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 57
 			$outcomes_attempted = (array)$activity->o_att_array;
50 58
 			if (array_key_exists($outcome_id, $outcomes_attempted) && $outcomes_attempted[$outcome_id] != 0) {
51 59
 				return true;
@@ -158,52 +166,50 @@ class Program extends Eloquent
158 166
 		foreach ($semesters as $semester) {
159 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 192
 			->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
185 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 214
 		// 		var_dump($outcome_id);
209 215
 		// 		var_dump($this->id);
@@ -218,13 +224,10 @@ class Program extends Eloquent
218 224
 			foreach ($students_attempted as $criteria_id => $students_attempted_n) {
219 225
 				if ($students_attempted_n) {
220 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 231
 					$conteo++;
229 232
 				}
230 233
 			}
@@ -247,52 +250,50 @@ class Program extends Eloquent
247 250
 		foreach ($semesters as $semester) {
248 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 276
 			->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
274 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 298
 		// 		var_dump($this->id);
298 299
 		// 		if(isset($students_attempted))var_dump($students_attempted);
@@ -306,13 +307,10 @@ class Program extends Eloquent
306 307
 			foreach ($students_attempted as $criteria_id => $students_attempted_n) {
307 308
 				if ($students_attempted_n) {
308 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 314
 					$conteo++;
317 315
 				}
318 316
 			}

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

@@ -117,10 +117,12 @@
117 117
         {{ Form::open(array('action' => 'ThreeYearPlanController@create' )) }}
118 118
         <p>Select a new cycle. You cannot choose a cycle that has been created before</p>
119 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 126
       </select>
125 127
       </div>
126 128
       <div class="modal-footer">

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

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

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

@@ -325,7 +325,7 @@
325 325
                 <div class="form-group col-md-11 editCourse">
326 326
                   <select name="courseid" id = "edit_course" class="form-control selectpicker">
327 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 329
                     @endforeach
330 330
                   </select>
331 331
                 </div>

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

@@ -31,7 +31,7 @@
31 31
                                     {{ $program->school->name }}: {{ $program->name }}
32 32
                                 </h4>
33 33
                             </th>
34
-                        </tr>
34
+                        </tr> 
35 35
                     </thead>
36 36
                     <tbody>
37 37
                         @if($program->assessesOutcome($outcome->id))
@@ -41,7 +41,7 @@
41 41
 
42 42
                                     <?php
43 43
 
44
-                                        $sections_evaluating = Course::has('activities')
44
+                                        /*$sections_evaluating = Course::has('activities')
45 45
                                         ->whereNotNull('outcomes_attempted')
46 46
                                         ->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'')
47 47
                                         ->with(array('activities'=>function($query) use(&$outcome){
@@ -49,7 +49,34 @@
49 49
                                             $query->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'');} ))
50 50
                                         ->where('code', $course->code)->where('number',$course->number)
51 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 82
                                     @if(count($sections_evaluating))
@@ -66,29 +93,25 @@
66 93
                                                 @foreach($section->activities as $index4 => $activity)
67 94
 
68 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 97
                                                         <h5>Measure {{ $index4 + 1 }}</h5>
71 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 100
                                                         <p>The results for each criterion were as follows:</p>
74 101
 
75 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 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 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 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 113
                                                                     </tr>
91
-                                                                @endif
114
+                                                                @endif  
92 115
                                                             @endforeach
93 116
                                                         </table>
94 117
 
@@ -121,9 +144,11 @@
121 144
                                                         @endif
122 145
                                                         <br><br>
123 146
 
124
-                                                    @else
147
+                                                    @elseif($activity->draft ==0)
125 148
                                                         <h5>Measure {{ $index4 + 1 }}</h5>
126 149
                                                         <em>Outcome not measured.</em>
150
+                                                    @else
151
+                                                    
127 152
                                                     @endif
128 153
                                                 @endforeach
129 154
                                             @endforeach

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

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

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

@@ -180,7 +180,7 @@ $(document).ready(function()
180 180
             var $button = $('<button/>', {
181 181
             'type': 'button',
182 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 186
             $button.append("+ Add criteria");
@@ -485,8 +485,8 @@ function addCriteriaTest(div, new_id_for_select, typ_course_id, i=null, options)
485 485
   }).html('x');
486 486
   $div.append($span);
487 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,7 +495,7 @@ function addCriteriaTest(div, new_id_for_select, typ_course_id, i=null, options)
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 501
 $('#allOutcomes').hide();

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

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

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

@@ -203,7 +203,7 @@
203 203
                 </div>
204 204
                 <div class="form-group">
205 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 208
                     </select>
209 209
                 </div>
@@ -224,7 +224,7 @@
224 224
                 </div>
225 225
                 <div class="form-group">
226 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 228
                     @for($i = 1; $i <= 20; $i++)
229 229
                     @if(8%$i == 0)
230 230
                     @if($i==1)
@@ -316,7 +316,7 @@
316 316
     </div>
317 317
 </div>
318 318
 <script>
319
-  
319
+
320 320
     </script>
321 321
 @stop
322 322
 
@@ -355,7 +355,8 @@ function fetchObjective(outcome){
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 360
 function fetchCriteria(outcome, objective)
360 361
 {
361 362
     amount_of_scales = parseInt($('#number_of_scales').find(':selected').val());
@@ -995,6 +996,15 @@ $('.panel-heading').on('click', function()
995 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 1009
 // When trying to change the template, ask the user to confirm and reset the
1000 1010
 // rubric if s/he does

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

@@ -81,8 +81,9 @@ Log::info($activity->o_att_array);
81 81
 Log::info("this is the cap_array for ". $activity->name);
82 82
 Log::info($activity->cap_array);
83 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 87
                                             <h5>Measure {{ $index4 + 1 }}</h5>
87 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 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,10 +141,13 @@ Log::info('aqui papi');?>
140 141
                                                 None
141 142
                                             @endif
142 143
 
143
-                                        @else
144
+                                        @elseif ($activity->draft == 0)
144 145
                                             <h5>Measure {{ $index4 + 1 }}</h5>
145 146
                                             <em>Outcome not measured.</em>
146
-                                        @endif
147
+                                        @else
148
+                                        
149
+                                            @endif
150
+
147 151
                                     @endforeach
148 152
                                 @endforeach
149 153
                                 </td>

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

@@ -120,7 +120,7 @@ echo
120 120
                         <th>Student</th>
121 121
                         @foreach ($rubric_contents as $index=>$criterion)
122 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 124
                         @endforeach
125 125
                         <th>Student Percentage</th>
126 126
                         <th>Student % per Weight<th>
@@ -141,8 +141,8 @@ echo
141 141
                         <!-- For each criterion in the rubric, there's a score field -->
142 142
                         @for ($i = 0; $i<sizeof($rubric_contents); $i++)
143 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 146
                                 @else
147 147
                                 N/A
148 148
                                 @endif
@@ -172,7 +172,7 @@ echo
172 172
 </div>
173 173
 
174 174
 
175
-<?
175
+<?php
176 176
 
177 177
 echo '</body>';
178 178
 echo '</html>';
@@ -257,6 +257,8 @@ echo '</html>';
257 257
             {
258 258
                 sum += val;
259 259
                 total+=1;
260
+              
261
+
260 262
                 per_of_weight += val * parseInt($('#weight-'+index).val()); 
261 263
             sum_of_weight += parseInt($('#weight-'+index).val());
262 264
             }
@@ -272,7 +274,7 @@ echo '</html>';
272 274
         percentage_per_weight ="0.00";
273 275
 
274 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,8 +99,8 @@
99 99
                     <!-- For each criterion in the rubric, there's a score field -->
100 100
                     @for ($i = 0; $i<sizeof($rubric_criterion); $i++)
101 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 104
                             @else
105 105
                             N/A
106 106
                             @endif