|
@@ -23,15 +23,17 @@
|
23
|
23
|
</div>
|
24
|
24
|
<div class="modal-body">
|
25
|
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>
|
|
26
|
+ <thead id = "criteria-header">;
|
|
27
|
+ @for($i=0; $i<$rubric->num_scales; $i++)
|
|
28
|
+ <th>Scale {{$i+1}} ({{1+($i*($rubric->max_score/$rubric->num_scales))}} - {{(1+$i)*($rubric->max_score/$rubric->num_scales)}})</th>
|
|
29
|
+ @endfor
|
31
|
30
|
<th>Notes</th>
|
32
|
31
|
</thead>
|
33
|
32
|
<tbody>
|
34
|
|
- <tr></tr>
|
|
33
|
+ <tr>
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+ </tr>
|
35
|
37
|
</tbody>
|
36
|
38
|
</table>
|
37
|
39
|
</div>
|
|
@@ -59,8 +61,8 @@
|
59
|
61
|
<li>If a particular criterion was assessed but the student did not complete the necessary work, you must select "0". This <strong>will</strong> affect the student's score.</li>
|
60
|
62
|
<li>If a student did not complete any work for this activity, select "0" for all columns in that student's row.</li>
|
61
|
63
|
<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>
|
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>
|
|
64
|
+ <li>Cells with "N/A" <strong>will not</strong> be used to determine whether a criterion is achieved. Only scores from 0 to {{$rubric->max_score}} will be considered for this purpose.</li>
|
|
65
|
+ <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
|
66
|
|
65
|
67
|
</ul>
|
66
|
68
|
</div>
|
|
@@ -80,15 +82,16 @@
|
80
|
82
|
<li>Si un criterio particular fue evaluado, pero el estudiante no completó el trabajo necesario, debe seleccionar "0". Esto <strong>sí</strong> afectará la puntuación final del estudiante.</li>
|
81
|
83
|
<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
|
84
|
<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>
|
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>
|
|
85
|
+ <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 {{$rubric->max_score}} serán consideradas.</li>
|
|
86
|
+ <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
|
87
|
|
86
|
88
|
|
87
|
89
|
</ul>
|
88
|
90
|
</div>
|
89
|
91
|
|
90
|
92
|
</div>
|
91
|
|
-
|
|
93
|
+ <input type='hidden' id='max' name= 'max' value='{{$rubric->max_score}}'>
|
|
94
|
+ <input type ='hidden' id='num_of_scales' name ='num_of_scales' value ='{{$rubric->num_scales}}'>
|
92
|
95
|
<p id="course">Course: {{{ $course->code }}} {{{ $course->number }}}</p>
|
93
|
96
|
<p id="section">Section: {{{ $course->section }}}</p>
|
94
|
97
|
{{ HTML::linkAction('ActivitiesController@show', 'Back to Activity', array($activity->id), array('class'=>'btn btn-default btn-sm pull-right')) }}
|
|
@@ -97,16 +100,27 @@
|
97
|
100
|
|
98
|
101
|
<table data-rubric-id="{{{ $rubric->id }}}" id="assessment-table" class="table table-striped table-condensed table-bordered">
|
99
|
102
|
<thead>
|
|
103
|
+ <tr>
|
|
104
|
+ <th>
|
|
105
|
+ </th>
|
|
106
|
+ @foreach ($criterion_rubric as $index => $criterion)
|
|
107
|
+ <th data-criterion-id="{{{ $criterion->criterion_id }}}" ><div class="th-box">
|
|
108
|
+
|
|
109
|
+ Weight<input class="form-control" id="weight-{{$index}}" name='weight[]' type="text" value="{{$criterion->weight}}" data-activity-criterion-id="{{$criterion->activity_criterion_id}}">
|
|
110
|
+ </div></th>
|
|
111
|
+ @endforeach
|
|
112
|
+ </tr>
|
100
|
113
|
<tr>
|
101
|
114
|
<th>
|
102
|
115
|
<div class="th-box">
|
103
|
116
|
Student
|
104
|
117
|
</div>
|
105
|
118
|
</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>
|
|
119
|
+ @foreach ($criterion_rubric as $criterion)
|
|
120
|
+ <th class="criterion-field" data-activity-criterion-id = "{{$criterion->activity_criterion_id}}"data-rubric-criterion-id = "{{$criterion->rubric_criterion_id}}" data-criterion-id="{{{ $criterion->criterion_id }}}" ><div class="th-box">{{ $criterion->name}}</div></th>
|
108
|
121
|
@endforeach
|
109
|
122
|
<th>Student Percentage</th>
|
|
123
|
+ <th>Student % per Weight</th>
|
110
|
124
|
<th>Comments</th>
|
111
|
125
|
</tr>
|
112
|
126
|
</thead>
|
|
@@ -115,21 +129,21 @@
|
115
|
129
|
<!-- If the activity was assessed, load the assessment. Otherwise load empty sheet -->
|
116
|
130
|
@if(sizeof($assessments)!=0)
|
117
|
131
|
<!-- For each assessment -->
|
118
|
|
- @foreach ($assessments as $assessment)
|
|
132
|
+ @foreach ($students as $student)
|
119
|
133
|
<tr class="student-row">
|
120
|
134
|
<!-- Fetch student name -->
|
121
|
|
- <td class="student-field" data-student-id="{{ $assessment->student_id }}">
|
122
|
|
- {{{ $assessment->name }}}
|
|
135
|
+ <td class="student-field" data-student-id="{{ $student->id }}">
|
|
136
|
+ {{{ $student->name }}}
|
123
|
137
|
</td>
|
124
|
138
|
|
125
|
139
|
<!-- For each criterion in the rubric, there's a score field -->
|
126
|
|
- @for ($i = 0; $i<sizeof($rubric_contents); $i++)
|
|
140
|
+ @for ($i = 0; $i<sizeof($criterion_rubric); $i++)
|
127
|
141
|
<td class="score-field">
|
128
|
|
- <select name="" id="" class="form-control" data-toggle="tooltip" data-placement="right" title="{{{ $assessment->name }}}">
|
|
142
|
+ <select name="" id="" class="form-control" data-toggle="tooltip" data-placement="right" title="{{{ $student->name }}}">
|
129
|
143
|
<!-- Option from 0-8 -->
|
130
|
|
- @for ($j=0; $j<=8; $j++)
|
|
144
|
+ @for ($j=0; $j<=$rubric->max_score; $j++)
|
131
|
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 -->
|
132
|
|
- @if( $j == $scores_array[$assessment->id][$rubric_contents[$i]->id])
|
|
146
|
+ @if( $j == $scores_array[$student->id][$i])
|
133
|
147
|
<option value="{{$j}}" selected="selected">{{ $j }}</option>
|
134
|
148
|
@else
|
135
|
149
|
<option value="{{$j}}">{{ $j }}</option>
|
|
@@ -137,7 +151,7 @@
|
137
|
151
|
@endfor
|
138
|
152
|
|
139
|
153
|
<!-- N/A option -->
|
140
|
|
- @if( $scores_array[$assessment->id][$rubric_contents[$i]->id]=="N/A")
|
|
154
|
+ @if( $scores_array[$student->id][$i]=="N/A")
|
141
|
155
|
<option value="N/A" selected="selected">N/A</option>
|
142
|
156
|
@else
|
143
|
157
|
<option value="N/A">N/A</option>
|
|
@@ -145,9 +159,10 @@
|
145
|
159
|
</select>
|
146
|
160
|
</td>
|
147
|
161
|
@endfor
|
148
|
|
- <td class="percentage">{{{ $assessment->percentage }}}</td>
|
|
162
|
+ <td class="percentage"></td>
|
|
163
|
+ <td class="percentage-per-weight"></td>
|
149
|
164
|
<td class="">
|
150
|
|
- <textarea class="comments full-textarea" placeholder="Max. 255 characters" maxLength="255" >{{ $assessment->comments }}</textarea>
|
|
165
|
+ <textarea class="comments full-textarea" placeholder="Max. 255 characters" maxLength="255" >{{ $scores_array[$student->id]["comments"] }}</textarea>
|
151
|
166
|
</td>
|
152
|
167
|
</tr>
|
153
|
168
|
@endforeach
|
|
@@ -155,23 +170,18 @@
|
155
|
170
|
@foreach ($students as $student)
|
156
|
171
|
<tr class="student-row">
|
157
|
172
|
<td class="student-field" data-student-id={{ $student->id }}>{{{ $student->name }}}</td>
|
158
|
|
- @for ($i = 0; $i<sizeof($rubric_contents); $i++)
|
159
|
|
- <td class="score-field">
|
|
173
|
+ @for ($i = 0; $i<sizeof($criterion_rubric); $i++)
|
|
174
|
+ <td class="score-field" data-weight = '1'>
|
160
|
175
|
<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>
|
|
176
|
+ @for($j=0; $j<=$rubric->max_score; $j++)
|
|
177
|
+ <option value ='{{$j}}'>{{$j}}</option>
|
|
178
|
+ @endfor
|
170
|
179
|
<option selected="selected" value="N/A">N/A</option>
|
171
|
180
|
</select>
|
172
|
181
|
</td>
|
173
|
182
|
@endfor
|
174
|
183
|
<td class="percentage"></td>
|
|
184
|
+ <td class="percentage-per-weight"></td>
|
175
|
185
|
<td class="comments"><textarea class="comments full-textarea" placeholder="Max. 255 characters" maxLength="255" ></textarea></td>
|
176
|
186
|
</tr>
|
177
|
187
|
@endforeach
|
|
@@ -182,7 +192,7 @@
|
182
|
192
|
<td>
|
183
|
193
|
<strong>Passed Criteria Percentage </strong>
|
184
|
194
|
</td>
|
185
|
|
- @for ($i = 0; $i<sizeof($rubric_contents); $i++)
|
|
195
|
+ @for ($i = 0; $i<sizeof($criterion_rubric); $i++)
|
186
|
196
|
<td class="total"><strong><span class="total-value"></span><span class="percent-sign">%</span></strong>
|
187
|
197
|
</td>
|
188
|
198
|
@endfor
|
|
@@ -198,7 +208,147 @@
|
198
|
208
|
</div>
|
199
|
209
|
</div>
|
200
|
210
|
</div>
|
|
211
|
+<script>
|
|
212
|
+$('#button-submit-assessment, #button-draft-assessment').on('click', function(e)
|
|
213
|
+{
|
|
214
|
+
|
|
215
|
+ var draft = 0;
|
|
216
|
+
|
|
217
|
+ if($(this).hasClass('draft'))
|
|
218
|
+ draft = 1;
|
|
219
|
+
|
|
220
|
+ var expected_points = parseInt($('#expected_points').text());
|
|
221
|
+ var expected_percentage = parseInt($('#expected_percentage').text());
|
|
222
|
+
|
|
223
|
+ //Prevent page refresh
|
|
224
|
+ e.preventDefault();
|
|
225
|
+
|
|
226
|
+ // Row in the database
|
|
227
|
+ var activity_id = $('#activity').data('activity-id');
|
|
228
|
+
|
|
229
|
+ var student_info = new Object();
|
|
230
|
+
|
|
231
|
+ // Object to hold the score sum of each criterion
|
|
232
|
+ var criteriaSumObject = new Object();
|
|
233
|
+
|
|
234
|
+ // Object to hold % of students that passed each criterion
|
|
235
|
+ var CriteriaAchievedPercentage = new Object();
|
|
236
|
+
|
|
237
|
+ // Object to hold all student evaluations
|
|
238
|
+ var studentAssessments = new Array();
|
|
239
|
+
|
|
240
|
+ var weights = new Object();
|
|
241
|
+
|
|
242
|
+ $('input[name="weight[]"]').each(function (index){
|
|
243
|
+ activity_criterion_id = $(this).data('activity-criterion-id');
|
|
244
|
+ weights[activity_criterion_id] = $(this).val();
|
|
245
|
+ });
|
|
246
|
+
|
|
247
|
+ // Iterate through all students
|
|
248
|
+ $('#assessment-table tbody tr').each(function( index )
|
|
249
|
+ {
|
|
250
|
+
|
|
251
|
+ student_info[index] = new Object()
|
|
252
|
+ student_info[index].studentId = $(this).find('.student-field').data('student-id');
|
|
253
|
+ student_info[index].activity_crit_id = new Object();
|
|
254
|
+
|
|
255
|
+ /* var ScoresObject = new Object(); // Scores column in database
|
|
256
|
+ var CriterionObject = new Object(); // Objects inside ScoresObject
|
|
257
|
+ var SingleStudentAssessment = new Object();
|
|
258
|
+ SingleStudentAssessment.student_id = $(this).find('.student-field').data('student-id');
|
|
259
|
+ */
|
|
260
|
+ // For each criterion, store the score in array
|
|
261
|
+ $(this).children('td.score-field').each(function(index2)
|
|
262
|
+ {
|
|
263
|
+ // Table cell with a score
|
|
264
|
+ var scoreField = $(this);
|
|
265
|
+
|
|
266
|
+ // Criterion being evaluated in current iteration
|
|
267
|
+ 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
|
+
|
|
270
|
+ // Score in the cell
|
|
271
|
+ //var score = scoreField.children('select').find(':selected').val();
|
|
272
|
+
|
|
273
|
+ // Store the score in the scores Object
|
|
274
|
+ //ScoresObject[criterion_id]=score;
|
|
275
|
+
|
|
276
|
+ // Initialize the index for the sum object, if it's undefined
|
|
277
|
+ //if(typeof(criteriaSumObject[criterion_id]) == 'undefined')
|
|
278
|
+ //{
|
|
279
|
+ // criteriaSumObject[criterion_id]=0;
|
|
280
|
+ //}
|
|
281
|
+
|
|
282
|
+ // Add to this criterion's total
|
|
283
|
+ //criteriaSumObject[criterion_id]+=parseInt(score);
|
|
284
|
+ });
|
|
285
|
+ student_info[index].comments = $.trim($(this).find('.comments').val());
|
|
286
|
+
|
|
287
|
+ //SingleStudentAssessment.scores = ScoresObject;
|
|
288
|
+ //SingleStudentAssessment.percentage = $(this).find('.percentage').text();
|
|
289
|
+ //SingleStudentAssessment.comments = $.trim($(this).find('.comments').val());
|
|
290
|
+ // console.log('comment '+index+': '+SingleStudentAssessment.comments);
|
|
291
|
+ // console.log('student object: '+JSON.stringify(SingleStudentAssessment));
|
|
292
|
+
|
|
293
|
+ //var clone = jQuery.extend({}, SingleStudentAssessment);
|
|
294
|
+ //studentAssessments.push(clone);
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+ });
|
|
298
|
+
|
|
299
|
+ // console.log('students: '+JSON.stringify(studentAssessments));
|
|
300
|
+ // console.log('total points per criteria: '+JSON.stringify(criteriaSumObject));
|
|
301
|
+
|
|
302
|
+ // Iterate through all evaluated criteria, determining which were achieved
|
|
303
|
+ // by comparing the completion percentage to the expected percentage
|
|
304
|
+ /*var CriteriaAchievedResults = new Object();
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+ $('.total').each(function(index)
|
|
308
|
+ {
|
|
309
|
+ var id = $('.criterion-field').eq(index).data('criterion-id');
|
|
310
|
+
|
|
311
|
+ CriteriaAchievedPercentage[id] = parseFloat($(this).find('span').text());
|
|
312
|
+
|
|
313
|
+ //Set whether criterion was achieved (1) or not (0)
|
|
314
|
+ if(CriteriaAchievedPercentage[id] >= expected_percentage)
|
|
315
|
+ {
|
|
316
|
+ CriteriaAchievedResults[id]=1;
|
|
317
|
+ }
|
|
318
|
+ else if (CriteriaAchievedPercentage[id] < expected_percentage)
|
|
319
|
+ {
|
|
320
|
+ CriteriaAchievedResults[id]=0;
|
|
321
|
+ }
|
|
322
|
+ else
|
|
323
|
+ {
|
|
324
|
+ CriteriaAchievedResults[id]=null;
|
|
325
|
+ }
|
|
326
|
+
|
|
327
|
+ });
|
|
328
|
+*/
|
|
329
|
+ // console.log('criteria percentages: '+JSON.stringify(CriteriaAchievedPercentage));
|
|
330
|
+ // console.log('criteria achieved results: '+JSON.stringify(CriteriaAchievedResults));
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+ // Save activity to the database
|
|
334
|
+ $.post
|
|
335
|
+ (
|
|
336
|
+ "{{ URL::action('ActivitiesController@saveAssessment') }}",
|
|
337
|
+ {
|
|
338
|
+ activity_id: activity_id,
|
|
339
|
+ draft: draft,
|
|
340
|
+ weights: JSON.stringify(weights),
|
|
341
|
+
|
|
342
|
+ student_info: JSON.stringify(student_info)
|
|
343
|
+ },
|
|
344
|
+ function(data)
|
|
345
|
+ {
|
|
346
|
+ location.replace(data);
|
|
347
|
+ }
|
|
348
|
+ );
|
201
|
349
|
|
|
350
|
+});
|
|
351
|
+ </script>
|
202
|
352
|
@stop
|
203
|
353
|
|
204
|
354
|
@section('included-js')
|
|
@@ -306,6 +456,9 @@ function percentagePerStudent(row)
|
306
|
456
|
var sum = 0 ;
|
307
|
457
|
var total = 0;
|
308
|
458
|
var percentage = 0;
|
|
459
|
+ var max_score = parseInt($('#max').val());
|
|
460
|
+ sum_of_weight = 0;
|
|
461
|
+ per_of_weight =0;
|
309
|
462
|
|
310
|
463
|
row.find('td.score-field').each(function(index)
|
311
|
464
|
{
|
|
@@ -314,10 +467,13 @@ function percentagePerStudent(row)
|
314
|
467
|
{
|
315
|
468
|
sum += val;
|
316
|
469
|
total+=1;
|
|
470
|
+ per_of_weight += val * parseInt($('#weight-'+index).val());
|
|
471
|
+ sum_of_weight += parseInt($('#weight-'+index).val());
|
317
|
472
|
}
|
318
|
|
- });
|
319
|
473
|
|
320
|
|
- percentage =((sum/(total*8))*100).toFixed(2);
|
|
474
|
+ });
|
|
475
|
+ percentage_per_weight = (100 *(per_of_weight/(max_score*sum_of_weight))).toFixed(2);
|
|
476
|
+ percentage =((sum/(total*max_score))*100).toFixed(2);
|
321
|
477
|
|
322
|
478
|
//If percentage is not a number, set it to 0.
|
323
|
479
|
if(isNaN(percentage))
|
|
@@ -329,6 +485,13 @@ function percentagePerStudent(row)
|
329
|
485
|
{
|
330
|
486
|
row.find('.percentage').html('<strong>'+percentage+'%</strong>');
|
331
|
487
|
}
|
|
488
|
+ if(isNaN(percentage_per_weight)){
|
|
489
|
+ percentage_per_weight="N/A";
|
|
490
|
+ row.find('.percentage-per-weight').html('<strong>'+percentage_per_weight+'</strong>');
|
|
491
|
+ }
|
|
492
|
+ else{
|
|
493
|
+ row.find('.percentage-per-weight').html('<strong>'+percentage_per_weight+'%</strong>');
|
|
494
|
+ }
|
332
|
495
|
|
333
|
496
|
|
334
|
497
|
}
|
|
@@ -382,131 +545,9 @@ $('select').on('change', function(e)
|
382
|
545
|
percentagePerStudent($(this).closest('tr'));
|
383
|
546
|
toggleSaveButton();
|
384
|
547
|
});
|
385
|
|
-
|
|
548
|
+//LA LINEA DONDE VA, 410
|
386
|
549
|
// Submit button is clicked
|
387
|
|
-$('#button-submit-assessment, #button-draft-assessment').on('click', function(e)
|
388
|
|
-{
|
389
|
550
|
|
390
|
|
- var draft = 0;
|
391
|
|
-
|
392
|
|
- if($(this).hasClass('draft'))
|
393
|
|
- draft = 1;
|
394
|
|
-
|
395
|
|
- var expected_points = parseInt($('#expected_points').text());
|
396
|
|
- var expected_percentage = parseInt($('#expected_percentage').text());
|
397
|
|
-
|
398
|
|
- //Prevent page refresh
|
399
|
|
- e.preventDefault();
|
400
|
|
-
|
401
|
|
- // Row in the database
|
402
|
|
- var activity_id = $('#activity').data('activity-id');
|
403
|
|
-
|
404
|
|
- // Object to hold the score sum of each criterion
|
405
|
|
- var criteriaSumObject = new Object();
|
406
|
|
-
|
407
|
|
- // Object to hold % of students that passed each criterion
|
408
|
|
- var CriteriaAchievedPercentage = new Object();
|
409
|
|
-
|
410
|
|
- // Object to hold all student evaluations
|
411
|
|
- var studentAssessments = new Array();
|
412
|
|
-
|
413
|
|
- // Iterate through all students
|
414
|
|
- $('#assessment-table tbody tr').each(function( index )
|
415
|
|
- {
|
416
|
|
- var ScoresObject = new Object(); // Scores column in database
|
417
|
|
- var CriterionObject = new Object(); // Objects inside ScoresObject
|
418
|
|
- var SingleStudentAssessment = new Object();
|
419
|
|
- SingleStudentAssessment.student_id = $(this).find('.student-field').data('student-id');
|
420
|
|
-
|
421
|
|
- // For each criterion, store the score in array
|
422
|
|
- $(this).children('td.score-field').each(function(index)
|
423
|
|
- {
|
424
|
|
- // Table cell with a score
|
425
|
|
- var scoreField = $(this);
|
426
|
|
-
|
427
|
|
- // Criterion being evaluated in current iteration
|
428
|
|
- var criterion_id = $('.criterion-field').eq(index).data('criterion-id');
|
429
|
|
-
|
430
|
|
- // Score in the cell
|
431
|
|
- var score = scoreField.children('select').find(':selected').val();
|
432
|
|
-
|
433
|
|
- // Store the score in the scores Object
|
434
|
|
- ScoresObject[criterion_id]=score;
|
435
|
|
-
|
436
|
|
- // Initialize the index for the sum object, if it's undefined
|
437
|
|
- if(typeof(criteriaSumObject[criterion_id]) == 'undefined')
|
438
|
|
- {
|
439
|
|
- criteriaSumObject[criterion_id]=0;
|
440
|
|
- }
|
441
|
|
-
|
442
|
|
- // Add to this criterion's total
|
443
|
|
- criteriaSumObject[criterion_id]+=parseInt(score);
|
444
|
|
- });
|
445
|
|
-
|
446
|
|
- SingleStudentAssessment.scores = ScoresObject;
|
447
|
|
- SingleStudentAssessment.percentage = $(this).find('.percentage').text();
|
448
|
|
- SingleStudentAssessment.comments = $.trim($(this).find('.comments').val());
|
449
|
|
- // console.log('comment '+index+': '+SingleStudentAssessment.comments);
|
450
|
|
- // console.log('student object: '+JSON.stringify(SingleStudentAssessment));
|
451
|
|
-
|
452
|
|
- var clone = jQuery.extend({}, SingleStudentAssessment);
|
453
|
|
- studentAssessments.push(clone);
|
454
|
|
-
|
455
|
|
-
|
456
|
|
- });
|
457
|
|
-
|
458
|
|
- // console.log('students: '+JSON.stringify(studentAssessments));
|
459
|
|
- // console.log('total points per criteria: '+JSON.stringify(criteriaSumObject));
|
460
|
|
-
|
461
|
|
- // Iterate through all evaluated criteria, determining which were achieved
|
462
|
|
- // by comparing the completion percentage to the expected percentage
|
463
|
|
- var CriteriaAchievedResults = new Object();
|
464
|
|
-
|
465
|
|
-
|
466
|
|
- $('.total').each(function(index)
|
467
|
|
- {
|
468
|
|
- var id = $('.criterion-field').eq(index).data('criterion-id');
|
469
|
|
-
|
470
|
|
- CriteriaAchievedPercentage[id] = parseFloat($(this).find('span').text());
|
471
|
|
-
|
472
|
|
- //Set whether criterion was achieved (1) or not (0)
|
473
|
|
- if(CriteriaAchievedPercentage[id] >= expected_percentage)
|
474
|
|
- {
|
475
|
|
- CriteriaAchievedResults[id]=1;
|
476
|
|
- }
|
477
|
|
- else if (CriteriaAchievedPercentage[id] < expected_percentage)
|
478
|
|
- {
|
479
|
|
- CriteriaAchievedResults[id]=0;
|
480
|
|
- }
|
481
|
|
- else
|
482
|
|
- {
|
483
|
|
- CriteriaAchievedResults[id]=null;
|
484
|
|
- }
|
485
|
|
-
|
486
|
|
- });
|
487
|
|
-
|
488
|
|
- // console.log('criteria percentages: '+JSON.stringify(CriteriaAchievedPercentage));
|
489
|
|
- // console.log('criteria achieved results: '+JSON.stringify(CriteriaAchievedResults));
|
490
|
|
-
|
491
|
|
-
|
492
|
|
- // Save activity to the database
|
493
|
|
- $.post
|
494
|
|
- (
|
495
|
|
- "{{ URL::action('ActivitiesController@saveAssessment') }}",
|
496
|
|
- {
|
497
|
|
- activity_id: activity_id,
|
498
|
|
- draft: draft,
|
499
|
|
- criteria_achieved_percentage: JSON.stringify(CriteriaAchievedPercentage),
|
500
|
|
- criteria_achievement: JSON.stringify(CriteriaAchievedResults),
|
501
|
|
- student_scores: JSON.stringify(studentAssessments),
|
502
|
|
- },
|
503
|
|
- function(data)
|
504
|
|
- {
|
505
|
|
- location.replace(data);
|
506
|
|
- }
|
507
|
|
- );
|
508
|
|
-
|
509
|
|
-});
|
510
|
551
|
|
511
|
552
|
// Language button is clicked
|
512
|
553
|
$('#button-language').on('click', function(e)
|
|
@@ -523,25 +564,24 @@ $('.criterion-field').on('click', function()
|
523
|
564
|
type: 'POST',
|
524
|
565
|
url: "{{ URL::action('RubricsController@fetchRubricCriterion') }}",
|
525
|
566
|
data: {
|
526
|
|
- rubric_id: $(this).closest('table').data('rubric-id'),
|
527
|
|
- criterion_id: $(this).data('criterion-id'),
|
|
567
|
+ rubric_criterion_id: $(this).data('rubric-criterion-id')
|
528
|
568
|
},
|
529
|
569
|
success: function(data)
|
530
|
570
|
{
|
531
|
571
|
data = JSON.parse(data);
|
532
|
|
- $('.modal-title').html(data.name);
|
533
|
|
-
|
|
572
|
+ $('.modal-title').html(data.criteria.name);
|
|
573
|
+ descriptions = '';
|
534
|
574
|
$('.modal-body tbody tr').empty();
|
|
575
|
+ for(i =0; i<{{$rubric->num_scales}}; i++){
|
|
576
|
+ descriptions += '<td>'+data[i].description+'</td>'
|
|
577
|
+ }
|
535
|
578
|
$('.modal-body tbody tr').append
|
536
|
579
|
(
|
537
|
|
- '<td>'+data.description12+'</td>'
|
538
|
|
- +'<td>'+data.description34+'</td>'
|
539
|
|
- +'<td>'+data.description56+'</td>'
|
540
|
|
- +'<td>'+data.description78+'</td>'
|
|
580
|
+ descriptions
|
541
|
581
|
);
|
542
|
582
|
|
543
|
|
- if(data.notes!=null)
|
544
|
|
- $('.modal-body tbody tr').append('<td>'+data.notes+'</td>');
|
|
583
|
+ if(data.criteria.notes!=null)
|
|
584
|
+ $('.modal-body tbody tr').append('<td>'+data.criteria.notes+'</td>');
|
545
|
585
|
else
|
546
|
586
|
$('.modal-body tbody tr').append('<td></td>');
|
547
|
587
|
|