round scores in student mastery gradebook

fixes CNVS-13601

test plan
- create some outcome results with fractional scores (live
 assessments are great for this)
- view them in the student mastery gradebook
- ensure that the scores are rounded to two decimal places
- click to view the alignment details
- ensure that scores on the alignment details dialog are rounded

Change-Id: Ie46dd732597619c44479cb9c7000c0debe0aa2c0
Reviewed-on: https://gerrit.instructure.com/36380
Reviewed-by: Braden Anderson <braden@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
This commit is contained in:
Joel Hough 2014-06-12 17:30:29 -06:00
parent 0f1c92f23e
commit 400f49ca4f
4 changed files with 12 additions and 4 deletions

View File

@ -21,6 +21,13 @@ define [
else
'undefined'
roundedScore: ->
score = @get('score')
if _.isNumber(score)
Math.round(score * 100.0) / 100.0
else
null
scoreDefined: ->
_.isNumber(@get('score'))
@ -36,6 +43,7 @@ define [
toJSON: ->
_.extend super,
status: @status()
roundedScore: @roundedScore()
scoreDefined: @scoreDefined()
percentProgress: @percentProgress()
masteryPercent: @masteryPercent()

View File

@ -1,5 +1,5 @@
<div class="title">{{name}}</div>
<div class="outcome-bar-wrapper">
<div class="score"><strong>{{score}}</strong>/{{mastery_points}}</div>
<div class="score"><strong>{{roundedScore}}</strong>/{{mastery_points}}</div>
{{view progress}}
</div>

View File

@ -21,8 +21,8 @@
</div>
<div class="outcome-score outcome-bar-wrapper">
{{view progress}}
<span class="score" aria-label="Score: {{score}} out of {{points_possible}} points with mastery at {{mastery_points}}">
<strong>{{#if scoreDefined}}{{score}}{{else}}-{{/if}}</strong>/{{mastery_points}}
<span class="score" aria-label="Score: {{roundedScore}} out of {{points_possible}} points with mastery at {{mastery_points}}">
<strong>{{#if scoreDefined}}{{roundedScore}}{{else}}-{{/if}}</strong>/{{mastery_points}}
</span>
<a href="#tab-outcomes/{{id}}">{{#t 'alignment_count'}}<strong>{{count}}</strong> Alignments{{/t}}</a>
</div>

View File

@ -3,7 +3,7 @@
{{friendly_name}}
</div>
<div class="outcome-bar-wrapper">
<div class="score"><strong>{{#if scoreDefined}}{{score}}{{else}}-{{/if}}</strong>/{{mastery_points}}</div>
<div class="score"><strong>{{#if scoreDefined}}{{roundedScore}}{{else}}-{{/if}}</strong>/{{mastery_points}}</div>
{{view progress}}
</div>
<div class="description">{{{description}}}</div>