diff --git a/server/routes/admin.js b/server/routes/admin.js index 1860244..1681573 100644 --- a/server/routes/admin.js +++ b/server/routes/admin.js @@ -330,6 +330,10 @@ router.post('/writeconfig', (req, res, next) => { // for flagAttempts, convert checkbox + selection to string if (key === 'flagAttempts') v = v.length === 3 ? v[2] : ''; + if (key === 'possibleScores') { + v = v.split(',').map(x => Number(x)); + } + // for sections data, parse csv file if (key === 'sections') { if (value) { diff --git a/server/routes/checkin.js b/server/routes/checkin.js index 2733929..7a1d47e 100644 --- a/server/routes/checkin.js +++ b/server/routes/checkin.js @@ -33,6 +33,8 @@ router.get('/:student_id', authRequired, (req, res) => { let section; const flags = {}; + const possibleScores = config.get('possibleScores'); + // render page with queried data and relevant configs function renderPage() { res.render('checkin', { @@ -43,8 +45,9 @@ router.get('/:student_id', authRequired, (req, res) => { radio: config.get('radioInput'), lab: config.get('manualLab'), allowOverride: config.get('allowOverride'), - minscore: Number.parseInt(config.get('minScore'), 10), - maxscore: Number.parseInt(config.get('maxScore'), 10), + minscore: Math.min.apply(null, possibleScores), + maxscore: Math.max.apply(null, possibleScores), + possibleScores, flags, }); } diff --git a/server/util/version.js b/server/util/version.js index 94fcd06..30846c4 100644 --- a/server/util/version.js +++ b/server/util/version.js @@ -1,7 +1,7 @@ const axios = require('axios'); // current version -const current = 'v1.4.3'; +const current = 'v1.4.4'; let latest; // look for a new release on github diff --git a/server/views/checkin.hbs b/server/views/checkin.hbs index 5f9ab73..27a7a00 100644 --- a/server/views/checkin.hbs +++ b/server/views/checkin.hbs @@ -71,9 +71,9 @@
{{#if radio}} - +
- {{#each (range minscore maxscore)}} + {{#each possibleScores}} diff --git a/server/views/partials/config.hbs b/server/views/partials/config.hbs index 1e0890f..1212fd8 100644 --- a/server/views/partials/config.hbs +++ b/server/views/partials/config.hbs @@ -15,23 +15,20 @@
+

This is a comma-separated string of scores.

- +
- -
-
-
- -
- +
-

This is the offset from the course timezone to UTC.

+

This is the offset from the course timezone to UTC

+

(e.g. Eastern Standard Time is +4 hours)