Clearly document the values for GradingSchemeEntry
It is unclear what the values in a GradingSchemeEntry are and what is the smallest step that can be used.
app/controllers/grading_standards_api_controller.rb says:
# @model GradingSchemeEntry # { # "id": "GradingSchemeEntry", # "description": "", # "properties": { # "name": { # "description": "The name for an entry value within a GradingStandard that describes the range of the value", # "example": "A", # "type": "string" # }, # "value": { # "description": "The value for the name of the entry within a GradingStandard. The entry represents the lower bound of the range for the entry. This range includes the value up to the next entry in the GradingStandard, or 100 if there is no upper bound. The lowest value will have a lower bound range of 0.", # "example": 0.9, # "type": "integer" # } # } # }
app/jsx/grading/helpers/GradeInputHelper.js says:
import Big from 'big.js' import { gradeToScoreLowerBound, gradeToScoreUpperBound, indexOfGrade, scoreToGrade } from '../../gradebook/GradingSchemeHelper' import numberHelper from '../../shared/helpers/numberHelper' const MAX_PRECISION = 15 // the maximum precision of a score persisted to the database const PERCENTAGES = /[%%﹪٪]/ export const GradingSchemeBounds = Object.freeze({ LOWER: 'LOWER', UPPER: 'UPPER' }) function toNumber(bigValue) { return parseFloat(bigValue.round(MAX_PRECISION).toString(), 10) } function pointsFromPercentage(percentage, pointsPossible) { return toNumber(new Big(percentage).div(100).times(pointsPossible)) } function percentageFromPoints(points, pointsPossible) { return toNumber(new Big(points).div(pointsPossible).times(100)) }
Finally, a comment in app/jsx/gradebook/GradingSchemeHelper.js says:
// if the two scheme values are less than 1% apart, reduce the offset to 0.1% // this is the minimum granularity currently supported for grading schemes
So it is clear that the model is incorrect, the value is not an integer. The toNumber() clearly produces a floating-point value rounded to 15 digits of precision, but the comment about the minimum granularity says values must be more than 1% apart. So what is the actual minimum step size?
Labels
11 Comments
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.