Browse Source

Cambioos a rubrics, y poco de assessment

parent
commit
25016ca2d3

+ 12
- 4
app/controllers/ActivitiesController.php View File

170
         $criterion_rubric = DB::table('criteria')
170
         $criterion_rubric = DB::table('criteria')
171
             ->join("criterion_rubric", "criterion_rubric.criterion_id", "=", "criteria.id")
171
             ->join("criterion_rubric", "criterion_rubric.criterion_id", "=", "criteria.id")
172
             ->where('criterion_rubric.rubric_id', '=', $rubric->id)->get();
172
             ->where('criterion_rubric.rubric_id', '=', $rubric->id)->get();
173
+        Log::info($criterion_rubric);
174
+        $criterion_rubric_ids = DB::table('criterion_rubric')->where('rubric_id', '=', $rubric->id)->lists('id');
173
         Log::info($rubric);
175
         Log::info($rubric);
174
         Log::info($criterion_rubric);
176
         Log::info($criterion_rubric);
177
+        $scales = DB::table('scales')->join('rubric_criteria_scale', 'rubric_criteria_scale.scale_id', '=', 'scales.id')
178
+            ->whereIn('rubric_criteria_scale.rubric_criterion_id', $criterion_rubric_ids)->get();
179
+
180
+
175
 
181
 
176
-        $rubric_contents = json_decode($rubric->contents);
177
 
182
 
178
         // Get results
183
         // Get results
179
-        $assessments = DB::table('assessments')->join('students', 'assessments.student_id', '=', 'students.id')->where('activity_id', '=', $activity->id)->orderBy('assessments.id', 'asc')->get();
184
+        $activity_criterion_ids = DB::table('activity_criterion')->where("activity_id", '=', $activity->id)->lists('id');
185
+        Log::info($activity_criterion_ids);
186
+        $assessments = DB::table('assessments')->join('students', 'assessments.student_id', '=', 'students.id')->whereIn('activity_criterion_id', $activity_criterion_ids)->orderBy('assessments.id', 'asc')->get();
180
 
187
 
181
         // Decode the scores (blade workaround)
188
         // Decode the scores (blade workaround)
182
         $scores_array = array();
189
         $scores_array = array();
183
         foreach ($assessments as $index => $assessment) {
190
         foreach ($assessments as $index => $assessment) {
184
             $scores_array[$assessment->id] = json_decode($assessment->scores, true);
191
             $scores_array[$assessment->id] = json_decode($assessment->scores, true);
185
         }
192
         }
193
+        Log::info($rubric);
186
 
194
 
187
-        return View::make('local.professors.assessment', compact('activity', 'title', 'students', 'course', 'rubric_contents', 'assessments', 'scores_array', 'rubric'));
195
+        return View::make('local.professors.assessment', compact('activity', 'title', 'students', 'course', 'criterion_rubric', 'assessments', 'scores_array', 'rubric', 'scales'));
188
     }
196
     }
189
 
197
 
190
     public function saveAssessment()
198
     public function saveAssessment()
215
                             }
223
                             }
216
 
224
 
217
                             // Add the assessment to the pivot table
225
                             // Add the assessment to the pivot table
226
+
218
                             $student->assessed_activities()->attach($activity->id, array(
227
                             $student->assessed_activities()->attach($activity->id, array(
219
                                 'scores' => json_encode($single_student_data->scores),
228
                                 'scores' => json_encode($single_student_data->scores),
220
-                                'percentage' => $single_student_data->percentage,
221
                                 'comments' => $single_student_data->comments
229
                                 'comments' => $single_student_data->comments
222
                             ));
230
                             ));
223
                         }
231
                         }

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

54
     {
54
     {
55
         $json_to_send = array();
55
         $json_to_send = array();
56
         $json_to_send['criterion'] = DB::table('criteria')->where('id', '=', Input::get('id'))->first();
56
         $json_to_send['criterion'] = DB::table('criteria')->where('id', '=', Input::get('id'))->first();
57
+        $num_scales = Input::get('numberOfScale');
58
+        $criterionID = Input::get('id');
59
+        $json_to_send['scales'] = DB::select("select * from scales, template_criterion_scale where template_criterion_scale.template_criterion_id in (select id from template_criterion where template_criterion.template_id in (SELECT id FROM templates where num_scales = {$num_scales}) and template_criterion.criterion_id = {$criterionID}) and scales.id = template_criterion_scale.scale_id GROUP BY position order by position");
60
+        Log::info("select * from scales, template_criterion_scale where template_criterion_scale.template_criterion_id in (select id from template_criterion where template_criterion.template_id in (SELECT id FROM templates where num_scales = {$num_scales}) and template_criterion.criterion_id = {$criterionID}) and scales.id = template_criterion_scale.scale_id GROUP BY position order by position");
57
 
61
 
58
 
62
 
59
 
63
 
63
     public function fetchCriterion()
67
     public function fetchCriterion()
64
     {
68
     {
65
         $json_to_send = array();
69
         $json_to_send = array();
66
-        $json_to_send['criterion'] = DB::table('criteria')->where('id', '=', Input::get('id'))->first();
67
 
70
 
71
+        $json_to_send['criterion'] = DB::table('criteria')->where('id', '=', Input::get('id'))->first();
68
 
72
 
69
 
73
 
70
 
74
 

+ 23
- 7
app/controllers/RubricsController.php View File

105
             $rubricId = $rubric->id;
105
             $rubricId = $rubric->id;
106
             foreach ($criteria as $index => $criterion_id) {
106
             foreach ($criteria as $index => $criterion_id) {
107
                 DB::insert("insert into criterion_rubric (`rubric_id`,`criterion_id`) values ({$rubricId},{$criterion_id})");
107
                 DB::insert("insert into criterion_rubric (`rubric_id`,`criterion_id`) values ({$rubricId},{$criterion_id})");
108
+                DB::commit();
108
                 $rubric_criterion_id = DB::table('criterion_rubric')->where('rubric_id', '=', $rubricId)
109
                 $rubric_criterion_id = DB::table('criterion_rubric')->where('rubric_id', '=', $rubricId)
109
                     ->where('criterion_id', '=', $criterion_id)->first();
110
                     ->where('criterion_id', '=', $criterion_id)->first();
110
 
111
 
112
+
113
+
111
                 for ($i = 0; $i < count($scales[$index]); $i++) {
114
                 for ($i = 0; $i < count($scales[$index]); $i++) {
112
-                    $scale = new Scale;
113
-                    $scale->description = $scales[$index][$i];
114
-                    $scale->min_score = 1 + ($division * $i);
115
-                    $scale->max_score = ($division * ($i + 1));
116
-                    if ($scale->save()) {
115
+                    $scale =  Scale::where('description', '=', $scales[$index][$i])
116
+                        ->where('max_score', '=', ($division * ($i + 1)))
117
+                        ->where("min_score", '=', (1 + ($division * $i)))->first();
118
+                    Log::info($scale);
119
+                    if ($scale) {
117
                         DB::insert("insert into `rubric_criteria_scale` (`rubric_criterion_id`, `scale_id`, `position`) values ({$rubric_criterion_id->id},{$scale->id}, {$i})");
120
                         DB::insert("insert into `rubric_criteria_scale` (`rubric_criterion_id`, `scale_id`, `position`) values ({$rubric_criterion_id->id},{$scale->id}, {$i})");
121
+                        DB::commit();
118
                     } else {
122
                     } else {
119
-                        Session::flash('status', 'danger');
120
-                        Session::flash('message', 'Rubric could not be created.');
123
+                        $scale = new Scale;
124
+                        $scale->description = $scales[$index][$i];
125
+                        $scale->min_score = 1 + ($division * $i);
126
+                        $scale->max_score = ($division * ($i + 1));
127
+                        if ($scale->save()) {
128
+                            DB::insert("insert into `rubric_criteria_scale` (`rubric_criterion_id`, `scale_id`, `position`) values ({$rubric_criterion_id->id},{$scale->id}, {$i})");
129
+                            DB::commit();
130
+                        } else {
131
+                            Session::flash('status', 'danger');
132
+                            Session::flash('message', 'Rubric could not be created.');
133
+                        }
121
                     }
134
                     }
122
                 }
135
                 }
136
+                $activity_id = Input::get("activity_id");
137
+                DB::insert("insert into `activity_criterion` (`activity_id`,`criterion_id`) values ({$activity_id}, {$criterion_id})");
138
+                DB::commit();
123
             }
139
             }
124
             Session::flash('status', 'success');
140
             Session::flash('status', 'success');
125
             Session::flash('message', 'Rubric assigned.');
141
             Session::flash('message', 'Rubric assigned.');

+ 34
- 14
app/controllers/TemplatesController.php View File

154
 					->where('criterion_id', '=', $criterion_id)->first();
154
 					->where('criterion_id', '=', $criterion_id)->first();
155
 
155
 
156
 				for ($i = 0; $i < count($scales[$index]); $i++) {
156
 				for ($i = 0; $i < count($scales[$index]); $i++) {
157
-					$scale = new Scale;
158
-					$scale->description = $scales[$index][$i];
159
-					$scale->min_score = 1 + ($division * $i);
160
-					$scale->max_score = ($division * ($i + 1));
161
-					if ($scale->save()) {
157
+					$scale =  Scale::where('description', '=', $scales[$index][$i])
158
+						->where('max_score', '=', ($division * ($i + 1)))
159
+						->where("min_score", '=', (1 + ($division * $i)))->first();
160
+					Log::info($scale);
161
+					if ($scale) {
162
 						DB::insert("insert into `template_criterion_scale` (`template_criterion_id`, `scale_id`, `position`) values ({$template_criterion_id->id},{$scale->id}, {$i})");
162
 						DB::insert("insert into `template_criterion_scale` (`template_criterion_id`, `scale_id`, `position`) values ({$template_criterion_id->id},{$scale->id}, {$i})");
163
+						DB::commit();
163
 					} else {
164
 					} else {
164
-						Session::flash('status', 'danger');
165
-						Session::flash('message', 'Rubric could not be created.');
165
+						$scale = new Scale;
166
+						$scale->description = $scales[$index][$i];
167
+						$scale->min_score = 1 + ($division * $i);
168
+						$scale->max_score = ($division * ($i + 1));
169
+						if ($scale->save()) {
170
+							DB::insert("insert into `template_criterion_scale` (`template_criterion_id`, `scale_id`, `position`) values ({$template_criterion_id->id},{$scale->id}, {$i})");
171
+							DB::commit();
172
+						} else {
173
+							Session::flash('status', 'danger');
174
+							Session::flash('message', 'Rubric could not be created.');
175
+						}
166
 					}
176
 					}
167
 				}
177
 				}
168
 			}
178
 			}
263
 					->where('criterion_id', '=', $criterion_id)->first();
273
 					->where('criterion_id', '=', $criterion_id)->first();
264
 				DB::delete("delete from template_criterion_scale where template_criterion_id ={$template_criterion_id->id}");
274
 				DB::delete("delete from template_criterion_scale where template_criterion_id ={$template_criterion_id->id}");
265
 				for ($i = 0; $i < count($scales[$index]); $i++) {
275
 				for ($i = 0; $i < count($scales[$index]); $i++) {
266
-					$scale = new Scale;
267
-					$scale->description = $scales[$index][$i];
268
-					$scale->min_score = 1 + ($division * $i);
269
-					$scale->max_score = ($division * ($i + 1));
270
-					if ($scale->save()) {
276
+					$scale =  Scale::where('description', '=', $scales[$index][$i])
277
+						->where('max_score', '=', ($division * ($i + 1)))
278
+						->where("min_score", '=', (1 + ($division * $i)))->first();
279
+					Log::info($scale);
280
+					if ($scale) {
271
 						DB::insert("insert into `template_criterion_scale` (`template_criterion_id`, `scale_id`, `position`) values ({$template_criterion_id->id},{$scale->id}, {$i})");
281
 						DB::insert("insert into `template_criterion_scale` (`template_criterion_id`, `scale_id`, `position`) values ({$template_criterion_id->id},{$scale->id}, {$i})");
282
+						DB::commit();
272
 					} else {
283
 					} else {
273
-						Session::flash('status', 'danger');
274
-						Session::flash('message', 'Rubric could not be created.');
284
+						$scale = new Scale;
285
+						$scale->description = $scales[$index][$i];
286
+						$scale->min_score = 1 + ($division * $i);
287
+						$scale->max_score = ($division * ($i + 1));
288
+						if ($scale->save()) {
289
+							DB::insert("insert into `template_criterion_scale` (`template_criterion_id`, `scale_id`, `position`) values ({$template_criterion_id->id},{$scale->id}, {$i})");
290
+							DB::commit();
291
+						} else {
292
+							Session::flash('status', 'danger');
293
+							Session::flash('message', 'Rubric could not be created.');
294
+						}
275
 					}
295
 					}
276
 				}
296
 				}
277
 			}
297
 			}

+ 0
- 3
app/models/Scale.php View File

4
 
4
 
5
 class Scale extends Eloquent
5
 class Scale extends Eloquent
6
 {
6
 {
7
-    use SoftDeletingTrait;
8
-    protected $dates = ['deleted_at'];
9
-
10
     protected $table = 'scales';
7
     protected $table = 'scales';
11
 
8
 
12
     public function outcomes()
9
     public function outcomes()

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

16
 
16
 
17
   public function assessed_activities()
17
   public function assessed_activities()
18
   {
18
   {
19
-  	return $this->belongsToMany('Activity', 'assessments')->withPivot('scores', 'percentage')->withTimestamps();
19
+    //return $this->belongsToMany('Activity', 'assessments')->withPivot('scores', 'percentage')->withTimestamps();
20
+    return $this->belongsToMany('Activity', 'assessments')->withPivot('scores')->withTimestamps();
20
   }
21
   }
21
 }
22
 }

+ 11
- 2
app/views/local/managers/shared/rubrics.blade.php View File

371
 
371
 
372
     // Check for duplicates
372
     // Check for duplicates
373
     var duplicates=false;
373
     var duplicates=false;
374
+    numberOfScale = $('#number_of_scales').find(':selected').val();
374
     $('tbody tr').each(function()
375
     $('tbody tr').each(function()
375
     {
376
     {
376
         if ($(this).data('criterion-id') == id)
377
         if ($(this).data('criterion-id') == id)
398
     $.post
399
     $.post
399
     (
400
     (
400
         "{{ URL::route('fetchCriterionWithTemplate') }}",
401
         "{{ URL::route('fetchCriterionWithTemplate') }}",
401
-        { id: id},
402
+        { id: id,
403
+        numberOfScale: numberOfScale },
402
         function(data)
404
         function(data)
403
         {
405
         {
404
             // Append the fetched data
406
             // Append the fetched data
425
                 str+='<span>'+data.criterion.name+'</span><sup></sup>'+subcriteria+'</td>';
427
                 str+='<span>'+data.criterion.name+'</span><sup></sup>'+subcriteria+'</td>';
426
             }
428
             }
427
             numberOfScale = $('#number_of_scales').find(':selected').val();
429
             numberOfScale = $('#number_of_scales').find(':selected').val();
430
+            if(data.scales.length)
428
             for(i=0; i<numberOfScale; i++){
431
             for(i=0; i<numberOfScale; i++){
429
-                str+='<td class="editable" data-type="textarea"></td>';
432
+                str+='<td class="editable" data-type="textarea">'+data.scales[i].description+'</td>';
433
+                
430
           
434
           
431
             }
435
             }
436
+            else{
437
+                for(i=0; i<numberOfScale; i++){
438
+                str+='<td class="editable" data-type="textarea"></td>';
439
+            }
440
+        }
432
 
441
 
433
             str +='<th><span class="glyphicon glyphicon-remove icon-btn" aria-hidden="true"></span></th></tr>';
442
             str +='<th><span class="glyphicon glyphicon-remove icon-btn" aria-hidden="true"></span></th></tr>';
434
 
443
 

+ 55
- 27
app/views/local/professors/assessment.blade.php View File

23
             </div>
23
             </div>
24
             <div class="modal-body">
24
             <div class="modal-body">
25
                 <table class="table table-bordered">
25
                 <table class="table table-bordered">
26
-                    <thead>
27
-                        <th>Beginning (1-2)</th>
28
-                        <th>In Progress (3-4)</th>
29
-                        <th>Good (5-6)</th>
30
-                        <th>Excellent (7-8)</th>
31
-                        <th>Notes</th>
26
+                    <thead id = "criteria-header">;
27
+                        
32
                     </thead>
28
                     </thead>
33
                     <tbody>
29
                     <tbody>
34
                         <tr></tr>
30
                         <tr></tr>
60
                     <li>If a student did not complete any work for this activity, select "0" for all columns in that student's row.</li>
56
                     <li>If a student did not complete any work for this activity, select "0" for all columns in that student's row.</li>
61
                     <li>If a student dropped the class, select "N/A" (Not Applicable) for all columns in that student's row.</li>
57
                     <li>If a student dropped the class, select "N/A" (Not Applicable) for all columns in that student's row.</li>
62
                     <li>Cells with "N/A" <strong>will not</strong> be used to determine whether a criterion is achieved. Only scores from 0 to 8 will be considered for this purpose.</li>
58
                     <li>Cells with "N/A" <strong>will not</strong> be used to determine whether a criterion is achieved. Only scores from 0 to 8 will be considered for this purpose.</li>
63
-                    <li><strong>At least one score must be from 1-8.</strong> Otherwise, the 'Publish Assessment' and 'Save as Draft' buttons will be <strong>disabled</strong>. If you want to delete previously saved scores, go back to the activity and click the "Delete Assessment" button.</li>
59
+                    <li>For this activity, <strong>at least one score must be from 1-{{$rubric->max_score}}.</strong> Otherwise, the 'Publish Assessment' and 'Save as Draft' buttons will be <strong>disabled</strong>. If you want to delete previously saved scores, go back to the activity and click the "Delete Assessment" button.</li>
64
 
60
 
65
                 </ul>
61
                 </ul>
66
             </div>
62
             </div>
81
                     <li>Si un estudiante no completó el trabajo para esta actividad, seleccione "0" en todas las columnas de la fila de ese estudiante.</li>
77
                     <li>Si un estudiante no completó el trabajo para esta actividad, seleccione "0" en todas las columnas de la fila de ese estudiante.</li>
82
                     <li>Si un estudiante se dio de baja, seleccione "N/A" (No Aplica) en todas las columnas de la fila de ese estudiante.</li>
78
                     <li>Si un estudiante se dio de baja, seleccione "N/A" (No Aplica) en todas las columnas de la fila de ese estudiante.</li>
83
                     <li>Las celdas con "N/A" <strong>no</strong> serán utilizadas para determinar si un criterio se alcanzó o no. Solamente las puntuaciones del 0 al 8 serán consideradas.</li>
79
                     <li>Las celdas con "N/A" <strong>no</strong> serán utilizadas para determinar si un criterio se alcanzó o no. Solamente las puntuaciones del 0 al 8 serán consideradas.</li>
84
-                    <li><strong>Al menos una puntuación deber ser del 1 al 8.</strong> De otra manera, el botón para guardar <strong>se desactivará</strong>. Si quiere borrar los resultados del avalúo, vuelva a la actividad y oprima el botón que dice "Delete Assessment".</li>
80
+                    <li>Para esta actividad, <strong>al menos una puntuación deber ser del 1 al {{$rubric->max_score}}.</strong> De otra manera, el botón para guardar <strong>se desactivará</strong>. Si quiere borrar los resultados del avalúo, vuelva a la actividad y oprima el botón que dice "Delete Assessment".</li>
85
 
81
 
86
 
82
 
87
                 </ul>
83
                 </ul>
88
             </div>
84
             </div>
89
 
85
 
90
         </div>
86
         </div>
91
-
87
+        <input type='hidden' id='max' name= 'max' value='{{$rubric->max_score}}'>
88
+        <input type ='hidden' id='num_of_scales' name ='num_of_scales' value ='{{$rubric->num_scales}}'>
92
         <p id="course">Course: {{{ $course->code }}} {{{ $course->number }}}</p>
89
         <p id="course">Course: {{{ $course->code }}} {{{ $course->number }}}</p>
93
         <p id="section">Section: {{{ $course->section }}}</p>
90
         <p id="section">Section: {{{ $course->section }}}</p>
94
         {{ HTML::linkAction('ActivitiesController@show', 'Back to Activity', array($activity->id), array('class'=>'btn btn-default btn-sm pull-right')) }}
91
         {{ HTML::linkAction('ActivitiesController@show', 'Back to Activity', array($activity->id), array('class'=>'btn btn-default btn-sm pull-right')) }}
103
                                 Student
100
                                 Student
104
                             </div>
101
                             </div>
105
                         </th>
102
                         </th>
106
-                        @foreach ($rubric_contents as $criterion)
107
-                            <th class="criterion-field" data-criterion-id="{{{ $criterion->id }}}"><div class="th-box">{{ $criterion->name}}</div></th>
103
+                        @foreach ($criterion_rubric as $criterion)
104
+                            <th class="criterion-field" data-criterion-id="{{{ $criterion->id }}}" ><div class="th-box">{{ $criterion->name}}</div></th>
108
                         @endforeach
105
                         @endforeach
109
                         <th>Student Percentage</th>
106
                         <th>Student Percentage</th>
110
                         <th>Comments</th>
107
                         <th>Comments</th>
123
                         </td>
120
                         </td>
124
 
121
 
125
                         <!-- For each criterion in the rubric, there's a score field -->
122
                         <!-- For each criterion in the rubric, there's a score field -->
126
-                        @for ($i = 0; $i<sizeof($rubric_contents); $i++)
123
+                        @for ($i = 0; $i<sizeof($criterion_rubric); $i++)
127
                             <td class="score-field">
124
                             <td class="score-field">
128
                                 <select name="" id="" class="form-control" data-toggle="tooltip" data-placement="right" title="{{{ $assessment->name }}}">
125
                                 <select name="" id="" class="form-control" data-toggle="tooltip" data-placement="right" title="{{{ $assessment->name }}}">
129
                                 <!-- Option from 0-8 -->
126
                                 <!-- Option from 0-8 -->
130
                                 @for ($j=0; $j<=8; $j++)
127
                                 @for ($j=0; $j<=8; $j++)
131
                                     <!-- If the decoded scores with index as the assessment id and second index as criterion id equals the loop index, mark it as selected -->
128
                                     <!-- If the decoded scores with index as the assessment id and second index as criterion id equals the loop index, mark it as selected -->
132
-                                    @if( $j ==  $scores_array[$assessment->id][$rubric_contents[$i]->id])
129
+                                    @if( $j ==  $scores_array[$assessment->id][$criterion_rubric[$i]->criterion_id])
133
                                         <option value="{{$j}}" selected="selected">{{ $j }}</option>
130
                                         <option value="{{$j}}" selected="selected">{{ $j }}</option>
134
                                     @else
131
                                     @else
135
                                         <option value="{{$j}}">{{ $j }}</option>
132
                                         <option value="{{$j}}">{{ $j }}</option>
137
                                 @endfor
134
                                 @endfor
138
 
135
 
139
                                 <!-- N/A option -->
136
                                 <!-- N/A option -->
140
-                                @if( $scores_array[$assessment->id][$rubric_contents[$i]->id]=="N/A")
137
+                                @if( $scores_array[$assessment->id][$criterion_rubric[$i]->criterion_id]=="N/A")
141
                                     <option value="N/A" selected="selected">N/A</option>
138
                                     <option value="N/A" selected="selected">N/A</option>
142
                                 @else
139
                                 @else
143
                                     <option value="N/A">N/A</option>
140
                                     <option value="N/A">N/A</option>
155
                 @foreach ($students as $student)
152
                 @foreach ($students as $student)
156
                     <tr class="student-row">
153
                     <tr class="student-row">
157
                         <td class="student-field" data-student-id={{ $student->id }}>{{{ $student->name }}}</td>
154
                         <td class="student-field" data-student-id={{ $student->id }}>{{{ $student->name }}}</td>
158
-                        @for ($i = 0; $i<sizeof($rubric_contents); $i++)
155
+                        @for ($i = 0; $i<sizeof($criterion_rubric); $i++)
159
                             <td class="score-field">
156
                             <td class="score-field">
160
                                 <select name="" id="" class="form-control" data-toggle="tooltip" data-placement="right" title="{{{ $student->name }}}">
157
                                 <select name="" id="" class="form-control" data-toggle="tooltip" data-placement="right" title="{{{ $student->name }}}">
161
-                                    <option value="0">0</option>
162
-                                    <option value="1">1</option>
163
-                                    <option value="2">2</option>
164
-                                    <option value="3">3</option>
165
-                                    <option value="4">4</option>
166
-                                    <option value="5">5</option>
167
-                                    <option value="6">6</option>
168
-                                    <option value="7">7</option>
169
-                                    <option value="8">8</option>
158
+                                    @for($i=0; $i<$rubric->max_score; $i++)
159
+                                    <option value ='{{$i}}'>{{$i}}</option>
160
+                                    @endfor
170
                                     <option selected="selected" value="N/A">N/A</option>
161
                                     <option selected="selected" value="N/A">N/A</option>
171
                                 </select>
162
                                 </select>
172
                             </td>
163
                             </td>
182
                     <td>
173
                     <td>
183
                         <strong>Passed Criteria Percentage </strong>
174
                         <strong>Passed Criteria Percentage </strong>
184
                     </td>
175
                     </td>
185
-                    @for ($i = 0; $i<sizeof($rubric_contents); $i++)
176
+                    @for ($i = 0; $i<sizeof($criterion_rubric); $i++)
186
                         <td class="total"><strong><span class="total-value"></span><span class="percent-sign">%</span></strong>
177
                         <td class="total"><strong><span class="total-value"></span><span class="percent-sign">%</span></strong>
187
                         </td>
178
                         </td>
188
                     @endfor
179
                     @endfor
198
         </div>
189
         </div>
199
     </div>
190
     </div>
200
 </div>
191
 </div>
192
+<script>
193
+    function changeTable(){
194
+    
195
+ 
196
+    amount_of_scales = parseInt($('#num_of_scales').val());
197
+    counter2 = 0;
198
+    maximum = parseInt($('#max').val());
199
+    
200
+   
201
+    newScaleHeaders = '';
202
+    counter = 0;
203
+    division = maximum/amount_of_scales;
204
+    if(amount_of_scales==1){
205
+        newScaleHeaders+= "<th>Score (1 - "+maximum+")</th>";
206
+    }
207
+    else if(maximum!= amount_of_scales){
208
+    while(counter <amount_of_scales){
209
+        
210
+        minimumScore = 1+(counter*division);
211
+        maximumScore = (1+counter)*division;
212
+        newScaleHeaders+= "<th>Scale "+ (counter +1) + " ("+minimumScore+" - "+maximumScore+")</th>";
213
+        counter++;
214
+    }
215
+    }else{
216
+        while(counter <amount_of_scales){
217
+        
201
 
218
 
219
+        newScaleHeaders+= "<th>Scale "+ (counter +1) + " </th>";
220
+        counter++;
221
+    }
222
+    }
223
+    newScaleHeaders += '<th>Notes</th>';
224
+    
225
+    $("#criterion-header").html(newScaleHeaders);
226
+    
227
+}
228
+    </script>
202
 @stop
229
 @stop
203
 
230
 
204
 @section('included-js')
231
 @section('included-js')
215
 // Page load
242
 // Page load
216
 // --------------------------------------------------------------------------
243
 // --------------------------------------------------------------------------
217
 
244
 
218
-
245
+changeTable();
219
 // Enable fixed headers
246
 // Enable fixed headers
220
 $('#assessment-table').stickyTableHeaders();
247
 $('#assessment-table').stickyTableHeaders();
221
 
248
 
306
     var sum = 0 ;
333
     var sum = 0 ;
307
     var total = 0;
334
     var total = 0;
308
     var percentage = 0;
335
     var percentage = 0;
336
+    var max_score = parseInt($('#max').val());
309
 
337
 
310
     row.find('td.score-field').each(function(index)
338
     row.find('td.score-field').each(function(index)
311
     {
339
     {
317
         }
345
         }
318
     });
346
     });
319
 
347
 
320
-    percentage =((sum/(total*8))*100).toFixed(2);
348
+    percentage =((sum/(total*max_score))*100).toFixed(2);
321
 
349
 
322
     //If percentage is not a number, set it to 0.
350
     //If percentage is not a number, set it to 0.
323
     if(isNaN(percentage))
351
     if(isNaN(percentage))