Browse Source

Bugs de rubrics y assessments

parent
commit
17238e53b3

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

283
                         }
283
                         }
284
                     }
284
                     }
285
                     $activity_draft = Input::get('draft');
285
                     $activity_draft = Input::get('draft');
286
-
286
+                    Log::info(json_encode($weights));
287
                     foreach ($weights as $act_crit => $weigh) {
287
                     foreach ($weights as $act_crit => $weigh) {
288
                         DB::update("update activity_criterion set weight = {$weigh} where id = {$act_crit}");
288
                         DB::update("update activity_criterion set weight = {$weigh} where id = {$act_crit}");
289
                     }
289
                     }
843
         $students = $course->students;
843
         $students = $course->students;
844
 
844
 
845
         // Get rubric contents
845
         // Get rubric contents
846
-        $rubric_contents = Rubric::select('contents')->where('id', '=', $activity->rubric_id)->get();
847
-        $rubric_contents = json_decode($rubric_contents['0']->contents);
846
+        $rubric = Rubric::find($activity->rubric[0]->id);
847
+        $rubric_contents = DB::table('criteria')
848
+            ->join("rubric_criterion", "rubric_criterion.criterion_id", "=", "criteria.id")
849
+            ->join("activity_criterion", "criteria.id", '=', 'activity_criterion.criterion_id')
850
+            ->where("activity_criterion.activity_id", '=', $activity->id)
851
+            ->where('rubric_criterion.rubric_id', '=', $rubric->id)
852
+            ->select('criteria.name', 'criteria.id as criterion_id', 'criteria.subcriteria')
853
+            ->addSelect('activity_criterion.activity_id', 'activity_criterion.weight', 'activity_criterion.id as activity_criterion_id')
854
+            ->addSelect('rubric_criterion.rubric_id', 'rubric_criterion.id as rubric_criterion_id')
855
+            ->get();
856
+
857
+        foreach ($rubric_contents as $index => $crit) {
858
+            $crit->scales = DB::table('scales')
859
+                ->join('criterion_scale', 'scales.id', '=', 'criterion_scale.scale_id')
860
+                ->where('criterion_id', $crit->criterion_id)
861
+                ->get();
862
+        }
863
+
864
+
848
 
865
 
849
-        $rubric = Rubric::find($activity->rubric_id);
850
 
866
 
851
         // Get results
867
         // Get results
852
-        $assessments = DB::table('assessments')->where('activity_id', '=', $activity->id)->orderBy('id', 'asc')->get();
868
+        /*$assessments = DB::table('assessments')->where('activity_id', '=', $activity->id)->orderBy('id', 'asc')->get();
853
 
869
 
854
         // Decode the scores (blade workaround)
870
         // Decode the scores (blade workaround)
855
         $scores_array = array();
871
         $scores_array = array();
856
         foreach ($assessments as $index => $assessment) {
872
         foreach ($assessments as $index => $assessment) {
857
             $scores_array[$assessment->id] = json_decode($assessment->scores, true);
873
             $scores_array[$assessment->id] = json_decode($assessment->scores, true);
874
+        }*/
875
+        // Get results
876
+        $activity_criterion_ids = DB::table('activity_criterion')->where("activity_id", '=', $activity->id)->lists('id');
877
+        Log::info($activity_criterion_ids);
878
+        $assessments = DB::table('assessments')
879
+            ->join('students', 'assessments.student_id', '=', 'students.id')
880
+            ->whereIn('activity_criterion_id', $activity_criterion_ids)
881
+            ->orderBy('assessments.id', 'asc')->get();
882
+        Log::info($assessments);
883
+        // Decode the scores (blade workaround)
884
+        $scores_array = array();
885
+
886
+        foreach ($assessments as $index => $assessment) {
887
+
888
+            $scores_array[$assessment->student_id][] = $assessment->score;
889
+            $scores_array[$assessment->student_id]['comments'] = DB::table('activity_student')->where('student_id', '=', $assessment->student_id)
890
+                ->where("activity_id", '=', $activity->id)
891
+                ->select('comments')->first()->comments;
858
         }
892
         }
859
 
893
 
894
+
860
         return View::make('local.professors.print_assessment', compact('activity', 'title', 'students', 'course', 'rubric_contents', 'assessments', 'scores_array', 'rubric'));
895
         return View::make('local.professors.print_assessment', compact('activity', 'title', 'students', 'course', 'rubric_contents', 'assessments', 'scores_array', 'rubric'));
861
     }
896
     }
862
 }
897
 }

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

806
 
806
 
807
     public function professorAssessmentReports()
807
     public function professorAssessmentReports()
808
     {
808
     {
809
-        $outcomes = Outcome::select(array('id', 'name', 'expected_outcome'))->orderBy('name', 'ASC')->get();
809
+        $semesters = Session::get('semesters_ids');
810
+        $semesters = DB::table('semesters')->whereIn('id', $semesters)->orderBy('start', 'ASC')->first();
811
+        Log::info($semesters->start);
812
+        $outcomes = Outcome::select(array('id', 'name', 'expected_outcome'))
813
+            ->where('deleted_at', '=', NULL)
814
+            ->whereRaw("(deactivation_date = NULL or deactivation_date >= '{$semesters->start}')")
815
+            ->orderBy('name', 'ASC')->get();
810
         $title = "My Courses' Assessment Reports";
816
         $title = "My Courses' Assessment Reports";
811
 
817
 
812
         return View::make('local.professors.assessment_reports', compact('title', 'outcomes'));
818
         return View::make('local.professors.assessment_reports', compact('title', 'outcomes'));

+ 45
- 3
app/controllers/RubricsController.php View File

380
             App::abort('403', 'Access Forbidden');
380
             App::abort('403', 'Access Forbidden');
381
 
381
 
382
         $rubric = Rubric::where('id', '=', $activity->rubric_id)->firstOrFail();
382
         $rubric = Rubric::where('id', '=', $activity->rubric_id)->firstOrFail();
383
+        $rubric_criterion = DB::table('criteria')
384
+            ->join('rubric_criterion', 'rubric_criterion.criterion_id', '=', 'criteria.id')
385
+            ->where('rubric_criterion.rubric_id', '=', $activity->rubric[0]->id)
386
+            ->get();
387
+        $rubric->titles = DB::table('titles')
388
+            ->join('rubric_title', 'rubric_title.title_id', '=', 'titles.id')
389
+            ->where('rubric_title.rubric_id', $rubric->id)
390
+            ->orderBy('position')
391
+            ->lists('text');
392
+
393
+        foreach ($rubric_criterion as $single_cr) {
394
+            $single_cr->scales = json_encode(DB::table('scales')
395
+                ->join('criterion_scale', 'criterion_scale.scale_id', '=', 'scales.id')
396
+                ->where('criterion_scale.criterion_id', '=', $single_cr->criterion_id)
397
+                ->orderBy('position')
398
+                ->lists('description'));
399
+            $single_cr->outcomes = json_encode(DB::table('outcomes')
400
+                ->join('criterion_objective_outcome', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
401
+                ->where('criterion_objective_outcome.criterion_id', '=', $single_cr->criterion_id)->lists('name'));
402
+        }
383
         $title = $activity->name . ': ' . $rubric->name;
403
         $title = $activity->name . ': ' . $rubric->name;
384
-        return View::make('local.professors.downloadrubric', compact('rubric', 'activity', 'title', 'course'));
404
+        return View::make('local.professors.downloadrubric', compact('rubric', 'rubric_criterion', 'activity', 'title', 'course'));
385
     }
405
     }
386
 
406
 
387
     public function printview($activity_id, $rubric_id)
407
     public function printview($activity_id, $rubric_id)
394
         if ($course->user_id != Auth::id())
414
         if ($course->user_id != Auth::id())
395
             App::abort('403', 'Access Forbidden');
415
             App::abort('403', 'Access Forbidden');
396
 
416
 
397
-        $rubric = Rubric::where('id', '=', $activity->rubric_id)->firstOrFail();
417
+        $rubric = Rubric::where('id', '=', $activity->rubric[0]->id)->firstOrFail();
418
+        $rubric_criterion = DB::table('criteria')
419
+            ->join('rubric_criterion', 'rubric_criterion.criterion_id', '=', 'criteria.id')
420
+            ->where('rubric_criterion.rubric_id', '=', $activity->rubric[0]->id)
421
+            ->get();
422
+        $rubric->titles = DB::table('titles')
423
+            ->join('rubric_title', 'rubric_title.title_id', '=', 'titles.id')
424
+            ->where('rubric_title.rubric_id', $rubric->id)
425
+            ->orderBy('position')
426
+            ->lists('text');
427
+
428
+        foreach ($rubric_criterion as $single_cr) {
429
+            $single_cr->scales = json_encode(DB::table('scales')
430
+                ->join('criterion_scale', 'criterion_scale.scale_id', '=', 'scales.id')
431
+                ->where('criterion_scale.criterion_id', '=', $single_cr->criterion_id)
432
+                ->orderBy('position')
433
+                ->lists('description'));
434
+
435
+
436
+            $single_cr->outcomes = json_encode(DB::table('outcomes')
437
+                ->join('criterion_objective_outcome', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
438
+                ->where('criterion_objective_outcome.criterion_id', '=', $single_cr->criterion_id)->lists('name'));
439
+        }
398
         $title = $activity->name . ': ' . $rubric->name;
440
         $title = $activity->name . ': ' . $rubric->name;
399
-        return View::make('local.professors.printrubric', compact('rubric', 'activity', 'title', 'course'));
441
+        return View::make('local.professors.printrubric', compact('rubric', 'rubric_criterion', 'activity', 'title', 'course'));
400
     }
442
     }
401
 
443
 
402
     public function fetchRubricCriterion()
444
     public function fetchRubricCriterion()

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

191
   }
191
   }
192
 
192
 
193
   // o_att_array
193
   // o_att_array
194
+  public function is_assessed()
195
+  {
196
+    $all_criterion = DB::table('activity_criterion')
197
+      ->where('activity_criterion.activity_id', '=', $this->id)
198
+      ->lists('id');
199
+
200
+    $assessments = DB::table('assessments')
201
+      ->whereIn('activity_criterion_id', $all_criterion)
202
+      ->lists('id');
203
+
204
+    return boolval(count($assessments));
205
+  }
194
   public function getOAttArrayAttribute()
206
   public function getOAttArrayAttribute()
195
   {
207
   {
196
 
208
 

+ 12
- 5
app/views/local/professors/activity.blade.php View File

197
             <!-- If no rubric is assigned and the semester is active -->
197
             <!-- If no rubric is assigned and the semester is active -->
198
             @if(count($activity->rubric) == 0 && in_array($course->semester->id, $active_semesters))
198
             @if(count($activity->rubric) == 0 && in_array($course->semester->id, $active_semesters))
199
                 {{ HTML::linkAction('RubricsController@newRubric', 'Assign Rubric', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
199
                 {{ HTML::linkAction('RubricsController@newRubric', 'Assign Rubric', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
200
-                {{ HTML::linkAction('RubricsController@newOtherMethod', 'Assign Other Assessment Method', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
200
+                <!--{{ HTML::linkAction('RubricsController@newOtherMethod', 'Assign Other Assessment Method', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}-->
201
             @else
201
             @else
202
 
202
 
203
                 {{ HTML::linkAction('RubricsController@show', 'View Rubric', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
203
                 {{ HTML::linkAction('RubricsController@show', 'View Rubric', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
208
                 @endif
208
                 @endif
209
 
209
 
210
                 <!-- If there is no assessment and the semester is active -->
210
                 <!-- If there is no assessment and the semester is active -->
211
-                @if($activity->o_att_array == NULL && in_array($course->semester->id, $active_semesters))
211
+                @if(!$activity->is_assessed() && in_array($course->semester->id, $active_semesters))
212
                     {{ HTML::linkAction('ActivitiesController@assess', 'Assess', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
212
                     {{ HTML::linkAction('ActivitiesController@assess', 'Assess', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
213
                 @else
213
                 @else
214
                     {{ HTML::linkAction('ActivitiesController@viewAssessment', 'View Assessment Sheet', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
214
                     {{ HTML::linkAction('ActivitiesController@viewAssessment', 'View Assessment Sheet', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
353
     $('#criteriaGraph').highcharts({
353
     $('#criteriaGraph').highcharts({
354
         chart: {
354
         chart: {
355
             type: 'bar',
355
             type: 'bar',
356
-            height: {{{ count($activity->criteria_achieved() )*22+225 }}},
356
+            height: 
357
+            @if($activity->is_assessed())
358
+            
359
+                {{ count($activity->criteria_achieved() )*22+225 }}
360
+            @else
361
+                {{22+225}}
362
+            @endif
363
+            ,
357
         },
364
         },
358
         title: {
365
         title: {
359
             text: 'Criteria Achievement',
366
             text: 'Criteria Achievement',
360
         },
367
         },
361
         xAxis: {
368
         xAxis: {
362
             categories: [
369
             categories: [
363
-                @if($activity->cap_array!=NULL)
370
+                @if($activity->is_assessed())
364
                     @foreach($activity->criteria_achieved() as $id=>$value)
371
                     @foreach($activity->criteria_achieved() as $id=>$value)
365
                         "{{{ Criterion::withTrashed()->find($id)->name }}}",
372
                         "{{{ Criterion::withTrashed()->find($id)->name }}}",
366
                     @endforeach
373
                     @endforeach
436
                 y:-1
443
                 y:-1
437
             },
444
             },
438
             data:[
445
             data:[
439
-                @if($activity->cap_array!=NULL)
446
+                @if($activity->is_assessed())
440
                     @foreach($activity->cap_array as $id=>$crit)
447
                     @foreach($activity->cap_array as $id=>$crit)
441
 
448
 
442
                         //This conditional is to ignore criteria that weren't assessed. These would have a value of null.
449
                         //This conditional is to ignore criteria that weren't assessed. These would have a value of null.

+ 22
- 5
app/views/local/professors/assessment.blade.php View File

141
                             <td class="score-field">
141
                             <td class="score-field">
142
                                 <select name="" id="" class="form-control" data-toggle="tooltip" data-placement="right" title="{{{ $student->name }}}">
142
                                 <select name="" id="" class="form-control" data-toggle="tooltip" data-placement="right" title="{{{ $student->name }}}">
143
                                 <!-- Option from 0-8 -->
143
                                 <!-- Option from 0-8 -->
144
+                                
144
                                 @for ($j=0; $j<=$rubric->max_score; $j++)
145
                                 @for ($j=0; $j<=$rubric->max_score; $j++)
145
                                     <!-- If the decoded scores with index as the assessment id and second index as criterion id equals the loop index, mark it as selected -->
146
                                     <!-- If the decoded scores with index as the assessment id and second index as criterion id equals the loop index, mark it as selected -->
146
-                                    @if( $j ==  $scores_array[$student->id][$i])
147
+                                    <?php
148
+                                    Log::info($scores_array);
149
+                                    ?>
150
+                                    @if(array_key_exists($student->id, $scores_array) && $j ==  $scores_array[$student->id][$i])
147
                                         <option value="{{$j}}" selected="selected">{{ $j }}</option>
151
                                         <option value="{{$j}}" selected="selected">{{ $j }}</option>
148
                                     @else
152
                                     @else
149
                                         <option value="{{$j}}">{{ $j }}</option>
153
                                         <option value="{{$j}}">{{ $j }}</option>
151
                                 @endfor
155
                                 @endfor
152
 
156
 
153
                                 <!-- N/A option -->
157
                                 <!-- N/A option -->
154
-                                @if( $scores_array[$student->id][$i]=="N/A")
158
+                                @if( !array_key_exists($student->id, $scores_array)|| isset($scores_array[$student->id][$i]))
155
                                     <option value="N/A" selected="selected">N/A</option>
159
                                     <option value="N/A" selected="selected">N/A</option>
156
                                 @else
160
                                 @else
157
                                     <option value="N/A">N/A</option>
161
                                     <option value="N/A">N/A</option>
162
                         <td class="percentage"></td>
166
                         <td class="percentage"></td>
163
                         <td class="percentage-per-weight"></td>
167
                         <td class="percentage-per-weight"></td>
164
                         <td class="">
168
                         <td class="">
165
-                            <textarea class="comments full-textarea" placeholder="Max. 255 characters" maxLength="255" >{{ $scores_array[$student->id]["comments"] }}</textarea>
169
+                            <textarea class="comments full-textarea" placeholder="Max. 255 characters" maxLength="255" >
170
+                            
171
+                                @if(array_key_exists($student->id, $scores_array))
172
+                                {{ $scores_array[$student->id]["comments"] }}
173
+                                @endif
174
+                            </textarea>
166
                         </td>
175
                         </td>
167
                      </tr>
176
                      </tr>
168
                 @endforeach
177
                 @endforeach
209
     </div>
218
     </div>
210
 </div>
219
 </div>
211
 <script>
220
 <script>
221
+
212
 $('#button-submit-assessment, #button-draft-assessment').on('click', function(e)
222
 $('#button-submit-assessment, #button-draft-assessment').on('click', function(e)
213
 {
223
 {
214
 
224
 
265
 
275
 
266
             // Criterion being evaluated in current iteration
276
             // Criterion being evaluated in current iteration
267
             activity_criterion_id = $('.criterion-field').eq(index2).data('activity-criterion-id');
277
             activity_criterion_id = $('.criterion-field').eq(index2).data('activity-criterion-id');
268
-            student_info[index].activity_crit_id[activity_criterion_id] = scoreField.children('select').find(':selected').val();
269
-
278
+            score = scoreField.children('select').find(':selected').val();
279
+            if(score != "N/A")
280
+            student_info[index].activity_crit_id[activity_criterion_id] = score;
270
             // Score in the cell
281
             // Score in the cell
271
             //var score = scoreField.children('select').find(':selected').val();
282
             //var score = scoreField.children('select').find(':selected').val();
272
 
283
 
600
 });
611
 });
601
 
612
 
602
 
613
 
614
+$(window).load(function(){
615
+    $(".tableFloatingHeader").each(function(){
616
+        $(this).remove();
617
+    })
618
+});
619
+
603
 @stop
620
 @stop

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

118
             <thead>
118
             <thead>
119
                     <tr>
119
                     <tr>
120
                         <th>Student</th>
120
                         <th>Student</th>
121
-                        @foreach ($rubric_contents as $criterion)
122
-                            <th class="criterion-field" data-criterion-id="{{{ $criterion->id }}}">{{ $criterion->name}}</th>
121
+                        @foreach ($rubric_contents as $index=>$criterion)
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
                         @endforeach
124
                         @endforeach
124
                         <th>Student Percentage</th>
125
                         <th>Student Percentage</th>
126
+                        <th>Student % per Weight<th>
125
                     </tr>
127
                     </tr>
126
             </thead>
128
             </thead>
127
             <tbody>
129
             <tbody>
139
                         <!-- For each criterion in the rubric, there's a score field -->
141
                         <!-- For each criterion in the rubric, there's a score field -->
140
                         @for ($i = 0; $i<sizeof($rubric_contents); $i++)
142
                         @for ($i = 0; $i<sizeof($rubric_contents); $i++)
141
                             <td class="score-field">
143
                             <td class="score-field">
142
-                                {{ $scores_array[$assessment->id][$rubric_contents[$i]->id] }}
144
+                                @if(array_key_exists($assessment->student_id, $scores_array)&& isset($scores_array[$assessment->student_id][$i]))
145
+                                {{ $scores_array[$assessment->student_id][$i] }}
146
+                                @else
147
+                                N/A
148
+                                @endif
143
                             </td>
149
                             </td>
144
                         @endfor
150
                         @endfor
145
-                        <td class="percentage">{{{ $assessment->percentage }}}</td>
151
+                        <td class="percentage"></td>
152
+                        <td class="percentage-per-weight"></td>
146
                      </tr>
153
                      </tr>
147
                 @endforeach
154
                 @endforeach
148
             @endif
155
             @endif
239
         var sum = 0 ;
246
         var sum = 0 ;
240
         var total = 0;
247
         var total = 0;
241
         var percentage = 0;
248
         var percentage = 0;
249
+        var max_score = {{$rubric->max_score}};
250
+        var per_of_weight =0;
251
+        var sum_of_weight =0;
242
 
252
 
243
         row.find('td.score-field').each(function(index)
253
         row.find('td.score-field').each(function(index)
244
         {
254
         {
247
             {
257
             {
248
                 sum += val;
258
                 sum += val;
249
                 total+=1;
259
                 total+=1;
260
+                per_of_weight += val * parseInt($('#weight-'+index).val()); 
261
+            sum_of_weight += parseInt($('#weight-'+index).val());
250
             }
262
             }
251
         });
263
         });
264
+        percentage_per_weight = (100 *(per_of_weight/(max_score*sum_of_weight))).toFixed(2);
252
 
265
 
253
-        percentage =((sum/(total*8))*100).toFixed(2);
266
+        percentage =((sum/(total*max_score))*100).toFixed(2);
254
 
267
 
255
         //If percentage is not a number, set it to 0.
268
         //If percentage is not a number, set it to 0.
256
         if(isNaN(percentage))
269
         if(isNaN(percentage))
257
             percentage="0.00";
270
             percentage="0.00";
271
+        if(isNaN(percentage_per_weight))
272
+        percentage_per_weight ="0.00";
258
 
273
 
259
         row.find('.percentage').html('<strong>'+percentage+'%</strong>');
274
         row.find('.percentage').html('<strong>'+percentage+'%</strong>');
275
+        row.find('.percentage-per-weight').html('<strong>'+percentage+'%</strong>');
260
 
276
 
261
     }
277
     }
262
   });
278
   });

+ 22
- 13
app/views/local/professors/printrubric.blade.php View File

118
     <tr>
118
     <tr>
119
       <th></th>
119
       <th></th>
120
       <th>Criterion</th>
120
       <th>Criterion</th>
121
-      <th>Beginning (1-2)</th>
122
-      <th>In Progress (3-4)</th>
123
-      <th>Good (5-6)</th>
124
-      <th>Excellent (7-8)</th>
121
+      @foreach($rubric->titles as $position => $text)
122
+      <th>{{$text}} ({{1+ ($position*($rubric->max_score/$rubric->num_scales))}}-{{(1+$position)*($rubric->max_score/$rubric->num_scales)}})</th>
123
+      @endforeach
124
+     
125
       <th>Learning Outcome</th>
125
       <th>Learning Outcome</th>
126
       <th>Copyright</th>
126
       <th>Copyright</th>
127
       <th>Notes</th>
127
       <th>Notes</th>
128
     </tr>
128
     </tr>
129
   </thead>
129
   </thead>
130
   <tbody>
130
   <tbody>
131
-  @foreach(json_decode($rubric->contents) as $index => $criterion)
131
+    @foreach($rubric_criterion as $index=> $criterion)
132
     <tr>
132
     <tr>
133
       <td>{{ $index + 1 }}.</td>
133
       <td>{{ $index + 1 }}.</td>
134
       <td>
134
       <td>
136
 
136
 
137
         @if(property_exists($criterion, 'subcriteria'))
137
         @if(property_exists($criterion, 'subcriteria'))
138
           <ul class="list-unstyled">
138
           <ul class="list-unstyled">
139
-            @foreach($criterion->subcriteria as $subcriterion)
139
+            @foreach(json_decode($criterion->subcriteria) as $subcriterion)
140
                 <li>{{ $subcriterion }}</li>
140
                 <li>{{ $subcriterion }}</li>
141
             @endforeach
141
             @endforeach
142
           </ul>
142
           </ul>
143
         @endif
143
         @endif
144
       </td>
144
       </td>
145
-      <td>{{ nl2br($criterion->description12) }}</td>
146
-      <td>{{ nl2br($criterion->description34) }}</td>
147
-      <td>{{ nl2br($criterion->description56) }}</td>
148
-      <td>{{ nl2br($criterion->description78) }}</td>
149
-      <td>{{ Outcome::where('id', $criterion->outcome_id)->first()->name }}</td>
145
+      @foreach(json_decode($criterion->scales) as $index2 => $description)
146
+      <td>{{  nl2br($description) }}</td>
147
+      @endforeach
148
+      
149
+      <td>
150
+        <ol>
151
+        @foreach(json_decode($criterion->outcomes) as $outcome)
152
+        
153
+<li>{{$outcome}}</li>
154
+        
155
+        @endforeach
156
+      </ol>
157
+      </td>
150
       <td>
158
       <td>
151
       @if($criterion->copyright)
159
       @if($criterion->copyright)
152
         {{{ $criterion->copyright }}}
160
         {{{ $criterion->copyright }}}
157
         {{{ $criterion->notes }}}
165
         {{{ $criterion->notes }}}
158
       @endif
166
       @endif
159
       </td>
167
       </td>
160
-    </tr>
161
-  @endforeach
168
+    </tr>     
169
+    @endforeach
170
+
162
   </tbody>
171
   </tbody>
163
 </table>
172
 </table>
164
 
173
 

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

99
                     <!-- For each criterion in the rubric, there's a score field -->
99
                     <!-- For each criterion in the rubric, there's a score field -->
100
                     @for ($i = 0; $i<sizeof($rubric_criterion); $i++)
100
                     @for ($i = 0; $i<sizeof($rubric_criterion); $i++)
101
                         <td class="score-field text-center">
101
                         <td class="score-field text-center">
102
+                            @if(array_key_exists($student->id, $scores_array) && isset($scores_array[$student->id][$i]))
102
                             {{$scores_array[$student->id][$i]}}
103
                             {{$scores_array[$student->id][$i]}}
104
+                            @else
105
+                            N/A
106
+                            @endif
103
                         </td>
107
                         </td>
104
                             
108
                             
105
                     @endfor
109
                     @endfor
106
                     <td class="percentage text-center"></td>
110
                     <td class="percentage text-center"></td>
107
                     <td class="percentage-per-weight text-center"></td>
111
                     <td class="percentage-per-weight text-center"></td>
108
                     <td class="">
112
                     <td class="">
109
-                        <textarea class="comments full-textarea" placeholder="Max. 255 characters" maxLength="255" disabled >{{ $scores_array[$student->id]["comments"] }}</textarea>
113
+                        <textarea class="comments full-textarea" placeholder="Max. 255 characters" maxLength="255" disabled >
114
+                            @if(array_key_exists($student->id, $scores_array))
115
+                            {{ $scores_array[$student->id]["comments"] }}
116
+                            @endif
117
+                        </textarea>
110
                     </td>
118
                     </td>
111
                  </tr>
119
                  </tr>
112
             @endforeach
120
             @endforeach