Browse Source

arreglos sobre todo relacionados con rubricas, criterios y objetivos

parent
commit
ebe45e0ab4

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

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

+ 10
- 2
app/controllers/ActivitiesController.php View File

283
                     foreach ($student_data as $index => $student_dict) {
283
                     foreach ($student_data as $index => $student_dict) {
284
                         $student_id = $student_dict->studentId;
284
                         $student_id = $student_dict->studentId;
285
                         foreach ($student_dict->activity_crit_id as $act_crit_id => $score) {
285
                         foreach ($student_dict->activity_crit_id as $act_crit_id => $score) {
286
-                            if (DB::table('assessments')->where('student_id', '=', $student_id)
286
+                     	 	  Log::info(json_encode($score));
287
+                          if (DB::table('assessments')->where('student_id', '=', $student_id)
287
                                 ->where('activity_criterion_id', '=', $act_crit_id)
288
                                 ->where('activity_criterion_id', '=', $act_crit_id)
288
                                 ->first()
289
                                 ->first()
289
                             ) {
290
                             ) {
291
                                     ->where('activity_criterion_id', '=', $act_crit_id)
292
                                     ->where('activity_criterion_id', '=', $act_crit_id)
292
                                     ->update(array('score' => $score));
293
                                     ->update(array('score' => $score));
293
                             } else {
294
                             } else {
294
-                                DB::insert("insert into assessments (`activity_criterion_id`, `student_id`, `score`) values ({$act_crit_id}, {$student_id}, {$score})");
295
+                            	if($score==null)
296
+                            	{
297
+	                                DB::insert("insert into assessments (`activity_criterion_id`, `student_id`) values ({$act_crit_id}, {$student_id})");
298
+    							}
299
+    							else
300
+    							{	
301
+    	                            DB::insert("insert into assessments (`activity_criterion_id`, `student_id`, `score`) values ({$act_crit_id}, {$student_id}, {$score})");
302
+                            	}
295
                             }
303
                             }
296
                         }
304
                         }
297
                         if (DB::table('activity_student')
305
                         if (DB::table('activity_student')

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

28
 
28
 
29
 		if (!$validator->fails()) {
29
 		if (!$validator->fails()) {
30
 			//			TODO: Remove this for production environment
30
 			//			TODO: Remove this for production environment
31
-			if (App::environment('local', 'staging')) {
32
-				return $this->processLogin();
33
-			}
31
+// 			if (App::environment('local', 'staging')) {
32
+// 				return $this->processLogin();
33
+// 			}
34
 			try {
34
 			try {
35
 				// User input
35
 				// User input
36
 				$username = str_replace('@upr.edu', '', Input::get('email'));
36
 				$username = str_replace('@upr.edu', '', Input::get('email'));

+ 46
- 21
app/controllers/CoursesController.php View File

716
             //             	->join('students', 'assessments.student_id', '=', 'students.id')
716
             //             	->join('students', 'assessments.student_id', '=', 'students.id')
717
             //             	->where('activity_id', '=', $activity->id)->orderBy('assessments.id', 'asc')->get();
717
             //             	->where('activity_id', '=', $activity->id)->orderBy('assessments.id', 'asc')->get();
718
 
718
 
719
-            $assessments = DB::table('assessments')
720
-                ->join('students', 'assessments.student_id', '=', 'students.id')
721
-                ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
722
-                ->where('activity_criterion.activity_id', '=', $activity->id)->orderBy('assessments.id', 'asc')->get();
723
-
719
+//             $assessments = DB::table('assessments')
720
+//                 ->join('students', 'assessments.student_id', '=', 'students.id')
721
+//                 ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
722
+//                 ->where('activity_criterion.activity_id', '=', $activity->id)->orderBy('assessments.id', 'asc')->get();
723
+//             $assessments = DB::table('assessments')
724
+//                 ->join('students', 'assessments.student_id', '=', 'students.id')
725
+//                 ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
726
+//                 ->where('activity_criterion.activity_id', '=', $activity->id)->orderBy('assessments.id', 'asc')->get();
727
+// print json_encode($assessments);exit();
724
             // Get rubric contents
728
             // Get rubric contents
725
-            $rubric_contents = json_decode($activity->rubric->contents);
726
-
729
+//             $rubric_contents = json_decode($activity->rubric->contents);
730
+			$rubric_contents = $activity->allActivityCriterionInfo();
727
             $criterion_list = array('#', 'Name', 'School', 'Major');
731
             $criterion_list = array('#', 'Name', 'School', 'Major');
728
-
732
+			$students=$activity->assessed_students();
733
+// print json_encode($students);exit();
734
+			
729
             // Set criterion names
735
             // Set criterion names
730
             foreach ($rubric_contents as $criterion) {
736
             foreach ($rubric_contents as $criterion) {
731
                 $criterion_list[] = $criterion->name;
737
                 $criterion_list[] = $criterion->name;
739
             fputcsv($file, $criterion_list);
745
             fputcsv($file, $criterion_list);
740
 
746
 
741
             // Set student info and scores for each criterion
747
             // Set student info and scores for each criterion
742
-            foreach ($assessments as $assessment) {
743
-                $student = Student::find($assessment->student_id);
744
-                $scores = json_decode($assessment->scores, true);
745
-                fputcsv($file, array_merge(
746
-                    array($student->number, $student->name, $student->school_code, $student->conc_code),
748
+//             foreach ($assessments as $assessment) {
749
+//                 $student = Student::find($assessment->student_id);
750
+//                 $scores = json_decode($assessment->scores, true);
751
+//                 fputcsv($file, array_merge(
752
+//                     array($student->number, $student->name, $student->school_code, $student->conc_code),
753
+//                     $scores,
754
+//                     array($assessment->percentage, $assessment->comments)
755
+//                 ));
756
+//             }
757
+            foreach ($students as $student) {
758
+//                 $student = Student::find($assessment->student_id);
759
+//                 $scores = json_decode($assessment->scores, true);
760
+                $scores = $activity->student_scores($student->id);
761
+                $comm=$activity->student_comments($student->id);
762
+//                 print json_encode($activity->student_percentage($student->id));//exit();
763
+//                  var_dump($activity->student_percentage($student->id)[0]->percentage);//exit();
764
+				$resul= array_merge(
765
+                    array($student->id, $student->name, $student->school_code, $student->conc_code),
747
                     $scores,
766
                     $scores,
748
-                    array($assessment->percentage, $assessment->comments)
749
-                ));
767
+                    array($activity->student_percentage($student->id))
768
+                    ,
769
+                    array($activity->student_comments($student->id)->comments)
770
+                );
771
+//                     print json_encode($resul);//exit();
772
+//                      var_dump($resul);//exit();
773
+            
774
+                fputcsv($file,$resul);
750
             }
775
             }
751
             fputcsv($file, $empty_line);
776
             fputcsv($file, $empty_line);
752
         }
777
         }
753
-
778
+// exit();
754
         // Table with all activities and grades
779
         // Table with all activities and grades
755
 
780
 
756
         // Set headers for table
781
         // Set headers for table
775
             $assessed_activities = $course->assessedActivities;
800
             $assessed_activities = $course->assessedActivities;
776
             // Iterate over activities, get percentages and add them to the record array
801
             // Iterate over activities, get percentages and add them to the record array
777
             foreach ($assessed_activities as $activity) {
802
             foreach ($assessed_activities as $activity) {
778
-                $percentage = DB::table('assessments')
779
-                    ->select('percentage')
780
-                    ->where('student_id', '=', $student->id)
781
-                    ->where('activity_id', '=', $activity->id)->first();
803
+//                 $percentage = DB::table('assessments')
804
+//                     ->select('percentage')
805
+//                     ->where('student_id', '=', $student->id)
806
+//                     ->where('activity_id', '=', $activity->id)->first();
782
 
807
 
783
-                $student_record[] = $percentage->percentage;
808
+                $student_record[] = $activity->student_percentage($student->id);
784
             }
809
             }
785
 
810
 
786
             // Average
811
             // Average

+ 13
- 10
app/controllers/CriteriaController.php View File

888
             $parentesis = array('(', ')');
888
             $parentesis = array('(', ')');
889
             if ($criterion->save()) {
889
             if ($criterion->save()) {
890
                 $criterionId = $criterion->id;
890
                 $criterionId = $criterion->id;
891
-                DB::table('criterion_objective_outcome as cobo')
892
-                    ->join('program_criterion_objective_outcome as poco', 'poco.cri_obj_out_id', '=', 'cobo.id')
893
-                    ->where('cobo.criterion_id', $criterionId)
891
+                DB::table('criterion_objective_outcome')
892
+                    ->join('program_criterion_objective_outcome', 'program_criterion_objective_outcome.cri_obj_out_id', '=', 'criterion_objective_outcome.id')
893
+                    ->where('criterion_objective_outcome.criterion_id', $criterionId)
894
                     ->delete();
894
                     ->delete();
895
                 // DB::delete("delete from `criterion_objective_outcome` where `criterion_id` ={$criterionId}");
895
                 // DB::delete("delete from `criterion_objective_outcome` where `criterion_id` ={$criterionId}");
896
-                DB::delete("delete from `program_criterion` where `criterion_id` ={$criterionId}");
896
+//                 DB::delete("delete from `program_criterion` where `criterion_id` ={$criterionId}");
897
 
897
 
898
                 foreach ($clean_input['objective_id'] as $objective_id) {
898
                 foreach ($clean_input['objective_id'] as $objective_id) {
899
 
899
 
1202
     {
1202
     {
1203
 
1203
 
1204
         $role = Auth::user()->role;
1204
         $role = Auth::user()->role;
1205
-
1205
+// Log::info("fdsdff".json_encode($role));
1206
         $criterion_id = Input::get('criterion_id');
1206
         $criterion_id = Input::get('criterion_id');
1207
 
1207
 
1208
         switch ($role) {
1208
         switch ($role) {
1212
             case 2:
1212
             case 2:
1213
                 $program_ids = Program::where("school_id", Auth::user()->school_id)->lists('id');
1213
                 $program_ids = Program::where("school_id", Auth::user()->school_id)->lists('id');
1214
                 break;
1214
                 break;
1215
-
1216
             case 3:
1215
             case 3:
1216
+                $program_ids = Auth::user()->programs->lists('id');
1217
+                break;
1217
             case 4:
1218
             case 4:
1218
                 $program_ids = Program::whereIn('id', Auth::user()->programs->lists('id'));
1219
                 $program_ids = Program::whereIn('id', Auth::user()->programs->lists('id'));
1219
                 break;
1220
                 break;
1220
         }
1221
         }
1221
-        $outcomes_paired_ids = DB::table('criterion_objective_outcome as cobo')
1222
-            ->join('program_criterion_objective_outcome as poco', 'poco.cri_obj_out_id', '=', 'cobo.id')
1222
+
1223
+       $outcomes_paired_ids = DB::table('criterion_objective_outcome')
1224
+            ->join('program_criterion_objective_outcome', 'program_criterion_objective_outcome.cri_obj_out_id', '=', 'criterion_objective_outcome.id')
1223
             ->whereIn("program_id", $program_ids)
1225
             ->whereIn("program_id", $program_ids)
1224
             ->where('criterion_id', $criterion_id)
1226
             ->where('criterion_id', $criterion_id)
1225
-            ->select('cobo.outcome_id')
1227
+            ->select('criterion_objective_outcome.outcome_id')
1226
             ->distinct()
1228
             ->distinct()
1227
-            ->lists('cobo.outcome_id');
1229
+            ->lists('criterion_objective_outcome.outcome_id');
1228
 
1230
 
1231
+// Log::info($outcomes_paired_ids);
1229
 
1232
 
1230
         $json = [];
1233
         $json = [];
1231
         $json['outcomes'] = $outcomes_paired_ids;
1234
         $json['outcomes'] = $outcomes_paired_ids;

+ 6
- 4
app/controllers/TemplatesController.php View File

172
 				break;
172
 				break;
173
 		}
173
 		}
174
 
174
 
175
-
175
+Log::info(json_encode($user->programs->lists('id')));
176
 		return View::make('local.managers.admins.view_template', compact('template', 'title', 'can_edit'));
176
 		return View::make('local.managers.admins.view_template', compact('template', 'title', 'can_edit'));
177
 	}
177
 	}
178
 
178
 
304
 				->lists('criteria.id');
304
 				->lists('criteria.id');
305
 		}
305
 		}
306
 		// 			Log::info("aqui".(count($criteria)));
306
 		// 			Log::info("aqui".(count($criteria)));
307
-					Log::info(json_encode(($criteria)));
307
+// 					Log::info(json_encode(($criteria)));
308
 
308
 
309
 
309
 
310
 
310
 
402
 					->where('school_id', $template->school_id)->lists('programs.id');
402
 					->where('school_id', $template->school_id)->lists('programs.id');
403
 			} else {
403
 			} else {
404
 				$program_ids = DB::table('programs')
404
 				$program_ids = DB::table('programs')
405
-					->where('program_id', $template->program_id)->lists('programs.id');
405
+					->where('id', $template->program_id)->lists('programs.id');
406
 			}
406
 			}
407
 		} else {
407
 		} else {
408
 			$role = Auth::user()->role;
408
 			$role = Auth::user()->role;
510
 
510
 
511
 		$template->num_scales = count($titles);
511
 		$template->num_scales = count($titles);
512
 		$template->max_score = $max_score;
512
 		$template->max_score = $max_score;
513
+		$template->user_id = Auth::user()->id;
513
 
514
 
514
 		if ($template->save()) {
515
 		if ($template->save()) {
515
 
516
 
585
 			->join('template_criterion', 'template_criterion.criterion_id', '=', 'criteria.id')
586
 			->join('template_criterion', 'template_criterion.criterion_id', '=', 'criteria.id')
586
 			->where("template_criterion.template_id", '=', Input::get('id'))
587
 			->where("template_criterion.template_id", '=', Input::get('id'))
587
 			->get();
588
 			->get();
588
-		Log::info(json_encode($template_info['criterion']));
589
+		Log::info(json_encode($template_info['template']));
590
+		//Log::info(json_encode($template_info['criterion']));
589
 		// 				Log::info(($temp_crit->program_ids));
591
 		// 				Log::info(($temp_crit->program_ids));
590
 		foreach ($template_info['criterion'] as $temp_crit) {
592
 		foreach ($template_info['criterion'] as $temp_crit) {
591
 			$temp_crit->scales = DB::table('scales')
593
 			$temp_crit->scales = DB::table('scales')

+ 72
- 1
app/models/Activity.php View File

19
     return $this->belongsTo('Course');
19
     return $this->belongsTo('Course');
20
   }
20
   }
21
 
21
 
22
+//   public function assessed_students()
23
+//   {
24
+//     return $this->belongsToMany('Student', 'assessments')->withPivot('scores', 'percentage')->withTimestamps();
25
+//   }
22
   public function assessed_students()
26
   public function assessed_students()
23
   {
27
   {
24
-    return $this->belongsToMany('Student', 'assessments')->withPivot('scores', 'percentage')->withTimestamps();
28
+    return  DB::table('students')
29
+    	-> join('assessments','assessments.student_id','=','students.id')    
30
+    	-> join('activity_criterion','assessments.activity_criterion_id','=','activity_criterion.id')
31
+      ->where('activity_criterion.activity_id', '=', $this->id)
32
+      ->select('students.*')
33
+      ->distinct()
34
+      ->get();;
35
+  }
36
+  
37
+  public function student_scores($student_id)
38
+  {
39
+//       $assessments=DB::table('activity_criterion')
40
+//     	-> leftJoin('assessments','assessments.activity_criterion_id','=','activity_criterion.id')
41
+//       ->where('activity_criterion.activity_id', '=', $this->id)
42
+//       ->where('assessments.student_id', '=', $student_id)
43
+//       ->select('activity_criterion.id','score')
44
+//       ->orderBy('criterion_ids')
45
+//       ->get();
46
+//       $assessments=DB::table('assessments')
47
+//     	-> join('activity_criterion','assessments.activity_criterion_id','=','activity_criterion.id')
48
+//       ->where('activity_criterion.activity_id', '=', $this->id)
49
+//       ->where('assessments.student_id', '=', $student_id)
50
+//       ->select('activity_criterion.id','score')
51
+//       ->orderBy('criterion_id')
52
+//       ->get();
53
+    $activity_id=$this->id;
54
+    $assessments=DB::select(DB::raw("select id,  COALESCE(score,0) score from 
55
+    	(select activity_criterion_id, score from`assessments` where student_id= $student_id) a right OUTER join 
56
+    	(select id from `activity_criterion` where `activity_criterion`.`activity_id` = $activity_id) b on a.activity_criterion_id = b.id"));
57
+  
58
+    
59
+    $scores=array();
60
+    foreach($assessments as $assess)
61
+    {
62
+    	$scores[$assess->id]=$assess->score;
63
+    }
64
+    return  $scores;
65
+  }
66
+  
67
+  public function student_comments($student_id)
68
+  {
69
+      $comments=DB::table('activity_student')
70
+      ->where('activity_id', '=', $this->id)
71
+      ->where('student_id', '=', $student_id)
72
+      ->select('comments')
73
+      ->first();
74
+    
75
+    return  $comments;
76
+  }
77
+  
78
+   public function student_percentage($student_id)
79
+  {
80
+ //      $scores=DB::table('assessments')
81
+//     	-> join('activity_criterion','assessments.activity_criterion_id','=','activity_criterion.id')
82
+//       ->where('activity_criterion.activity_id', '=', $this->id)
83
+//       ->where('assessments.student_id', '=', $student_id)
84
+//       ->select('criterion_id','score')
85
+//       ->get();
86
+      //rubrics->expected_points
87
+    $activity_id=$this->id;
88
+ $percentage=DB::select(DB::raw("select COALESCE(ROUND(100*sum(score*weight)/sum(max_score*weight),2),0) percentage from (select activity_criterion_id, score from`assessments` where
89
+  student_id= $student_id) a right OUTER join 
90
+  (select id, weight, activity_id from `activity_criterion` where `activity_criterion`.`activity_id` = $activity_id) b on a.activity_criterion_id = b.id join 
91
+  rubric_activity on rubric_activity.activity_id=b.activity_id join rubrics on rubrics.id=rubric_activity.rubric_id"));
92
+    
93
+    return $percentage[0]->percentage;
25
   }
94
   }
95
+ 
26
   public function amount_of_assessed_students()
96
   public function amount_of_assessed_students()
27
   {
97
   {
28
 
98
 
137
       ->where('activity_id', $this->id)
207
       ->where('activity_id', $this->id)
138
       ->select('activity_criterion.activity_id', 'activity_criterion.criterion_id', 'criteria.*')
208
       ->select('activity_criterion.activity_id', 'activity_criterion.criterion_id', 'criteria.*')
139
       ->distinct()
209
       ->distinct()
210
+      ->orderBy('criteria.id')
140
       ->get();
211
       ->get();
141
 
212
 
142
 
213
 

+ 5
- 1
app/models/User.php View File

82
 	// return the programs the user is a pcoord of
82
 	// return the programs the user is a pcoord of
83
 	public function programs()
83
 	public function programs()
84
 	{
84
 	{
85
-		return $this->belongsToMany('Program')->select('programs.id', 'programs.name', 'programs.school_id', 'programs.is_graduate');
85
+// 		return $this->hasManyThrough('Program','Program_user')->select('programs.id', 'programs.name', 'programs.school_id', 'programs.is_graduate');
86
+// 		$sal= $this->belongsToMany('Program')->select('programs.id', 'programs.name', 'programs.school_id', 'programs.is_graduate');
87
+		$sal= $this->belongsToMany('Program')->select('programs.id', 'programs.name', 'programs.school_id', 'programs.is_graduate');
88
+		Log::info(json_encode($sal));
89
+		return $sal;
86
 	}
90
 	}
87
 }
91
 }

+ 44
- 38
app/views/local/managers/shared/rubrics_new.blade.php View File

524
             annual_plan_id:$(select).val()
524
             annual_plan_id:$(select).val()
525
         },
525
         },
526
         function(semesters){
526
         function(semesters){
527
-            console.log(semesters);
527
+            //console.log(semesters);
528
 
528
 
529
             options_for_semesters = makeOptionsForSemesters(semesters);
529
             options_for_semesters = makeOptionsForSemesters(semesters);
530
             $("#select-semester-plans").html(options_for_semesters);
530
             $("#select-semester-plans").html(options_for_semesters);
552
                 semester_id:$(semesters).val()
552
                 semester_id:$(semesters).val()
553
             },
553
             },
554
             function(courses){
554
             function(courses){
555
-                console.log(courses);
555
+                //console.log(courses);
556
                 options = makeOptionsForCourses(courses);
556
                 options = makeOptionsForCourses(courses);
557
                 $("#select-courses-plans").html(options);
557
                 $("#select-courses-plans").html(options);
558
                 $('.selectpicker').selectpicker('refresh');
558
                 $('.selectpicker').selectpicker('refresh');
582
                 number_of_scales:$(number_of_scales).val()
582
                 number_of_scales:$(number_of_scales).val()
583
             },
583
             },
584
             function(criteria){
584
             function(criteria){
585
-                console.log(criteria);
585
+                //console.log(criteria);
586
                 options_criteria = makeOptionsForCriteria(criteria)
586
                 options_criteria = makeOptionsForCriteria(criteria)
587
                 
587
                 
588
                 $('#select-criteria-plans').html(options);
588
                 $('#select-criteria-plans').html(options);
666
             annual_plan_id:annual_plan_id
666
             annual_plan_id:annual_plan_id
667
         },
667
         },
668
         function(outcomes){
668
         function(outcomes){
669
-            console.log(outcomes);
669
+            //console.log(outcomes);
670
 
670
 
671
             options_for_select = makeOptionsForOutcomes(outcomes);
671
             options_for_select = makeOptionsForOutcomes(outcomes);
672
             $("#select-outcomes-plans").html(options_for_select);
672
             $("#select-outcomes-plans").html(options_for_select);
679
 
679
 
680
 
680
 
681
 function fetchObjectives(select_outcome){
681
 function fetchObjectives(select_outcome){
682
-    console.log($(select_outcome).find('option:selected').html())
682
+    //console.log($(select_outcome).find('option:selected').html())
683
     option_selected = $(select_outcome).find('option:selected');
683
     option_selected = $(select_outcome).find('option:selected');
684
-    console.log($(select_outcome).find('option:selected').data('objectives'))
685
-    console.log($(select_outcome).val())
686
-    console.log(option_selected.val())
684
+    //console.log($(select_outcome).find('option:selected').data('objectives'))
685
+    //console.log($(select_outcome).val())
686
+    //console.log(option_selected.val())
687
     $.post(
687
     $.post(
688
         "{{URL::action('AnnualPlansController@fetchObjectivesFromPlan')}}",
688
         "{{URL::action('AnnualPlansController@fetchObjectivesFromPlan')}}",
689
         {
689
         {
700
     }
700
     }
701
 
701
 
702
     function makeOptionsForObjectives(objectives){
702
     function makeOptionsForObjectives(objectives){
703
-        console.log(objectives);
703
+        //console.log(objectives);
704
 
704
 
705
         option_selected = '';
705
         option_selected = '';
706
         
706
         
787
     }
787
     }
788
     else
788
     else
789
     {
789
     {
790
-        console.log('school', $('#select-school').find(':selected').data('school-id') );
791
-        console.log('program', $('#select-program').find(':selected').data('program-id') );
790
+        //console.log('school', $('#select-school').find(':selected').data('school-id') );
791
+        //console.log('program', $('#select-program').find(':selected').data('program-id') );
792
 
792
 
793
         // Update database
793
         // Update database
794
         $.post
794
         $.post
911
         
911
         
912
 
912
 
913
             str +='<th><span class="glyphicon glyphicon-remove icon-btn" aria-hidden="true"></span></th></tr>';
913
             str +='<th><span class="glyphicon glyphicon-remove icon-btn" aria-hidden="true"></span></th></tr>';
914
-	console.log(str);
914
+	//console.log(str);
915
 
915
 
916
             $('table tbody').append(str);
916
             $('table tbody').append(str);
917
 
917
 
962
 
962
 
963
                         copyrightNumber = Number.parseInt($(this).find('sup').text());
963
                         copyrightNumber = Number.parseInt($(this).find('sup').text());
964
 
964
 
965
-                        console.log('a: '+copyrightNumber);
965
+                        //console.log('a: '+copyrightNumber);
966
 
966
 
967
                         criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
967
                         criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
968
                         found =true;
968
                         found =true;
978
                 {
978
                 {
979
                     var copyrightNumber = $('#copyright-list li').length+1;
979
                     var copyrightNumber = $('#copyright-list li').length+1;
980
 
980
 
981
-                    console.log('b: '+copyrightNumber);
982
-                    console.log(criterion.children('td:nth-child(2)').find('sup').length);
981
+                    //console.log('b: '+copyrightNumber);
982
+                    //console.log(criterion.children('td:nth-child(2)').find('sup').length);
983
 
983
 
984
                     criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
984
                     criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
985
                     $('#copyright-list').append('<li><sup>'+copyrightNumber+' </sup><span>'+copyright+'<span></li>');
985
                     $('#copyright-list').append('<li><sup>'+copyrightNumber+' </sup><span>'+copyright+'<span></li>');
1058
         function(data)
1058
         function(data)
1059
         {
1059
         {
1060
             $('#select-criterion').empty();
1060
             $('#select-criterion').empty();
1061
-		console.log(data);
1061
+		//console.log(data);
1062
             // Append criteria
1062
             // Append criteria
1063
             data.forEach( function (arrayItem)
1063
             data.forEach( function (arrayItem)
1064
             {
1064
             {
1137
 
1137
 
1138
                         copyrightNumber = Number.parseInt($(this).find('sup').text());
1138
                         copyrightNumber = Number.parseInt($(this).find('sup').text());
1139
 
1139
 
1140
-                        console.log('a: '+copyrightNumber);
1140
+                        //console.log('a: '+copyrightNumber);
1141
 
1141
 
1142
                         criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
1142
                         criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
1143
                         found =true;
1143
                         found =true;
1153
                 {
1153
                 {
1154
                     var copyrightNumber = $('#copyright-list li').length+1;
1154
                     var copyrightNumber = $('#copyright-list li').length+1;
1155
 
1155
 
1156
-                    console.log('b: '+copyrightNumber);
1157
-                    console.log(criterion.children('td:nth-child(2)').find('sup').length);
1156
+                    //console.log('b: '+copyrightNumber);
1157
+                    //console.log(criterion.children('td:nth-child(2)').find('sup').length);
1158
 
1158
 
1159
                     criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
1159
                     criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
1160
                     $('#copyright-list').append('<li><sup>'+copyrightNumber+' </sup><span>'+copyright+'<span></li>');
1160
                     $('#copyright-list').append('<li><sup>'+copyrightNumber+' </sup><span>'+copyright+'<span></li>');
1195
 // Fetch programs associated to a specific school
1195
 // Fetch programs associated to a specific school
1196
 function fetchPrograms(school)
1196
 function fetchPrograms(school)
1197
 {
1197
 {
1198
+	//console.log(school.find(':selected'));
1198
     $.ajax({
1199
     $.ajax({
1199
         type: 'POST',
1200
         type: 'POST',
1200
         url: "{{ URL::action('ProgramsController@fetch') }}",
1201
         url: "{{ URL::action('ProgramsController@fetch') }}",
1238
             //Set the name of the rubric
1239
             //Set the name of the rubric
1239
             $('#rubric-name').val(data.template.name);
1240
             $('#rubric-name').val(data.template.name);
1240
 
1241
 
1241
-console.log(data.template.school_id);
1242
-console.log($('#select-school'));
1242
+//console.log($('#select-school'));
1243
             // Set school id to 0, then to the saved value if it exists
1243
             // Set school id to 0, then to the saved value if it exists
1244
             $('#select-school option[data-school-id="0"]').prop('selected', true);
1244
             $('#select-school option[data-school-id="0"]').prop('selected', true);
1245
             $('#select-school option[data-school-id="'+data.template.school_id+'"]').prop('selected', true);
1245
             $('#select-school option[data-school-id="'+data.template.school_id+'"]').prop('selected', true);
1246
-console.log($('#select-school'));
1246
+console.log("name"+data.template.name);
1247
+console.log("school"+data.template.school_id);
1248
+console.log("name"+data.template.name);
1247
 
1249
 
1248
             // Fetch programs associated to that school
1250
             // Fetch programs associated to that school
1249
             fetchPrograms($('#select-school'));
1251
             fetchPrograms($('#select-school'));
1252
+           // fetchPrograms(data.template.school_id);
1250
 
1253
 
1251
             // Set program id to 0, then to the saved value if it exists
1254
             // Set program id to 0, then to the saved value if it exists
1252
             $('#select-program option[data-program-id="0"]').prop('selected', true);
1255
             $('#select-program option[data-program-id="0"]').prop('selected', true);
1253
             $('#select-program option[data-program-id="'+data.template.program_id+'"]').prop('selected', true);
1256
             $('#select-program option[data-program-id="'+data.template.program_id+'"]').prop('selected', true);
1254
 
1257
 
1255
             // Set expected values
1258
             // Set expected values
1256
-            console.log(data.template.expected_percentage);
1259
+         //   console.log(data.template.expected_percentage);
1257
 
1260
 
1258
-            console.log(data.template.expected_points);
1259
-            console.log(data.template.max_score);
1261
+      //      console.log(data.template.expected_points);
1262
+        //    console.log(data.template.max_score);
1260
         
1263
         
1261
         $('#max_score').val(data.template.max_score);
1264
         $('#max_score').val(data.template.max_score);
1262
           
1265
           
1271
             changeTable();
1274
             changeTable();
1272
             // Set visibility
1275
             // Set visibility
1273
             var is_visible = data.template.is_visible;
1276
             var is_visible = data.template.is_visible;
1274
-            if(is_visible)
1277
+            console.log("is_visible",is_visible);
1278
+            if(is_visible==1)
1275
             {
1279
             {
1280
+            	console.log("entro?")
1276
                 $('#is_visible0').prop('checked', false);
1281
                 $('#is_visible0').prop('checked', false);
1277
                 $('#is_visible1').prop('checked', true);
1282
                 $('#is_visible1').prop('checked', true);
1278
             }
1283
             }
1279
             else
1284
             else
1280
             {
1285
             {
1281
-                $('#is_visible1').prop('checked', false);
1282
                 $('#is_visible0').prop('checked', true);
1286
                 $('#is_visible0').prop('checked', true);
1287
+                $('#is_visible1').prop('checked', false);
1283
             }
1288
             }
1284
 
1289
 
1285
 
1290
 
1286
             // Set the contents of the rubric
1291
             // Set the contents of the rubric
1287
             var temp_criterion = data.criterion;
1292
             var temp_criterion = data.criterion;
1288
-               console.log(temp_criterion);
1293
+       //        console.log(temp_criterion);
1289
             for(temp_c in temp_criterion){
1294
             for(temp_c in temp_criterion){
1290
                 current_criterion = temp_criterion[temp_c]
1295
                 current_criterion = temp_criterion[temp_c]
1291
-               console.log(current_criterion.program_ids);
1296
+       //        console.log(current_criterion.program_ids);
1292
                 objectives = JSON.stringify(current_criterion.objectives);
1297
                 objectives = JSON.stringify(current_criterion.objectives);
1293
                 //var str = '<tr data-assoc-objectives= '+"'"+objectives+"'"+' data-program_ids = "'+current_criterion.program_ids+'" data-criterion-name = "'+current_criterion.name+'" data-criterion-id="'+temp_criterion[temp_c].criterion_id+'" data-criterion-copyright="'+temp_criterion[temp_c].copyright+'" data-criterion-notes="'+temp_criterion[temp_c].notes+'" data-outcomes = "'+temp_criterion[temp_c].outcomes+'"><th><span class="glyphicon glyphicon-move"></span></th><td>';
1298
                 //var str = '<tr data-assoc-objectives= '+"'"+objectives+"'"+' data-program_ids = "'+current_criterion.program_ids+'" data-criterion-name = "'+current_criterion.name+'" data-criterion-id="'+temp_criterion[temp_c].criterion_id+'" data-criterion-copyright="'+temp_criterion[temp_c].copyright+'" data-criterion-notes="'+temp_criterion[temp_c].notes+'" data-outcomes = "'+temp_criterion[temp_c].outcomes+'"><th><span class="glyphicon glyphicon-move"></span></th><td>';
1294
                 var str = "<tr  data-program_ids = '"+current_criterion.program_ids+"' data-criterion-name = '"+current_criterion.name+"' data-criterion-id='"+temp_criterion[temp_c].criterion_id+"' data-criterion-copyright='"+temp_criterion[temp_c].copyright+"' data-criterion-notes='"+temp_criterion[temp_c].notes+"' data-outcomes = '"+temp_criterion[temp_c].outcomes+"'><th><span class='glyphicon glyphicon-move'></span></th><td>";
1299
                 var str = "<tr  data-program_ids = '"+current_criterion.program_ids+"' data-criterion-name = '"+current_criterion.name+"' data-criterion-id='"+temp_criterion[temp_c].criterion_id+"' data-criterion-copyright='"+temp_criterion[temp_c].copyright+"' data-criterion-notes='"+temp_criterion[temp_c].notes+"' data-outcomes = '"+temp_criterion[temp_c].outcomes+"'><th><span class='glyphicon glyphicon-move'></span></th><td>";
1295
-                console.log(str);
1300
+           //     console.log(str);
1296
 
1301
 
1297
                 var subcriteria ='';
1302
                 var subcriteria ='';
1298
                 if(current_criterion.subcriteria){
1303
                 if(current_criterion.subcriteria){
1323
                 str+= '<td>'+current_criterion.outcomes+'</td>'
1328
                 str+= '<td>'+current_criterion.outcomes+'</td>'
1324
   
1329
   
1325
                 str+='<th><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></th></tr>';
1330
                 str+='<th><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></th></tr>';
1326
-                console.log(str);
1331
+           //     console.log(str);
1327
 
1332
 
1328
     $('table tbody').append(str);
1333
     $('table tbody').append(str);
1329
 
1334
 
1421
         
1426
         
1422
             var template_program = selected.data('template-program-id');
1427
             var template_program = selected.data('template-program-id');
1423
          //   console.log(selected.data('template-program-id'));
1428
          //   console.log(selected.data('template-program-id'));
1424
-          //  console.log(programs.includes(selected.data('template-program-id').toString()));
1429
+            console.log("**"+programs.indexOf(selected.data('template-program-id').toString()));
1425
         
1430
         
1426
         if(
1431
         if(
1427
             {{ Auth::user()->role }}==1
1432
             {{ Auth::user()->role }}==1
1428
             || ({{ Auth::user()->role }}==2 && selected.data('admin')!=1)
1433
             || ({{ Auth::user()->role }}==2 && selected.data('admin')!=1)
1429
             || ({{ Auth::user()->role }}==3
1434
             || ({{ Auth::user()->role }}==3
1430
-                && programs.includes(selected.data('template-program-id'))
1431
-
1435
+                && programs.indexOf(selected.data('template-program-id'))
1432
                 && selected.data('admin')!=1
1436
                 && selected.data('admin')!=1
1433
             )
1437
             )
1434
         )
1438
         )
1543
         $('#button-confirm-update-rubric').prop('disabled', true);
1547
         $('#button-confirm-update-rubric').prop('disabled', true);
1544
         $('#button-print-rubric').prop('disabled', true);
1548
         $('#button-print-rubric').prop('disabled', true);
1545
     }
1549
     }
1546
-
1547
     // Otherwise, load the selected template
1550
     // Otherwise, load the selected template
1548
     else
1551
     else
1549
     {
1552
     {
1556
         
1559
         
1557
         var template_program = selected.data('template-program-id');
1560
         var template_program = selected.data('template-program-id');
1558
 <!--         var dataset = selected.dataSet.templateProgramId; -->
1561
 <!--         var dataset = selected.dataSet.templateProgramId; -->
1562
+//            console.log("***"+({{ Auth::user()->role }}==3
1563
+  //              && programs.indexOf(selected.data('template-program-id'))
1564
+    //            && selected.data('admin')!=1
1565
+      //      )+programs+template_program+{{ json_encode(Auth::user()->programs->lists('id')) }});
1559
 
1566
 
1560
         if(
1567
         if(
1561
             {{ Auth::user()->role }}==1
1568
             {{ Auth::user()->role }}==1
1562
             || ({{ Auth::user()->role }}==2 && selected.data('admin')!=1)
1569
             || ({{ Auth::user()->role }}==2 && selected.data('admin')!=1)
1563
             || ({{ Auth::user()->role }}==3
1570
             || ({{ Auth::user()->role }}==3
1564
-                && programs.includes(selected.data('template-program-id'))
1565
-
1571
+                && programs.indexOf(selected.data('template-program-id'))
1566
                 && selected.data('admin')!=1
1572
                 && selected.data('admin')!=1
1567
             )
1573
             )
1568
         )
1574
         )
1798
             console.log(program_ids);
1804
             console.log(program_ids);
1799
 			
1805
 			
1800
            // program_ids = $(this).data('program_ids')
1806
            // program_ids = $(this).data('program_ids')
1801
-            if(!program_ids.includes(program_id) ){
1807
+            if(!program_ids.indexOf(program_id) ){
1802
                 title = "<h6>The following criteria and objectives will be matched with this program</h6>"
1808
                 title = "<h6>The following criteria and objectives will be matched with this program</h6>"
1803
                 htmlString += "<ol style='list-style-position: inside'>"
1809
                 htmlString += "<ol style='list-style-position: inside'>"
1804
         
1810
         

+ 7
- 1
app/views/local/professors/assessment.blade.php View File

289
             activity_criterion_id = $('.criterion-field').eq(index2).data('activity-criterion-id');
289
             activity_criterion_id = $('.criterion-field').eq(index2).data('activity-criterion-id');
290
             score = scoreField.children('select').find(':selected').val();
290
             score = scoreField.children('select').find(':selected').val();
291
             if(score != "N/A")
291
             if(score != "N/A")
292
-            student_info[index].activity_crit_id[activity_criterion_id] = score;
292
+            {
293
+	            student_info[index].activity_crit_id[activity_criterion_id] = score;
294
+    		}
295
+    		else
296
+    		{
297
+    			student_info[index].activity_crit_id[activity_criterion_id] = null;
298
+    		}
293
             // Score in the cell
299
             // Score in the cell
294
             //var score = scoreField.children('select').find(':selected').val();
300
             //var score = scoreField.children('select').find(':selected').val();
295
 
301