Store LevelGroup results on a single namespaced object#7874
Conversation
`this.forceSubmittable` is never set. It looks like this was intended to be the local var.
{"1977":"0","2007":"3","1939":"2,1"} vs [{"level_id":1977,"result":"0"},{"level_id":2007,"result":"3"},{"level_id":1939,"result":"2,1"}]
| #{last_attempt.to_json} | ||
| ); | ||
| }); | ||
| window.levelGroup.results[#{level.id}] = new Multi( |
There was a problem hiding this comment.
It seems weird to be assigning a Multi object into something called results, doesn't it?
|
thanks, this lgtm. Tagging @laurelfan as an FYI, since she's been reviewing everything related to LevelGroup and long assessments so far. |
|
Oh, except main concern around assigning our level-behaviour objects into something called results. I think the name should probably be something closer to "level objects" but I'm not sure what offhand. |
|
Hmm, maybe |
|
This PR is also waiting for feedback from @laurelfan / @ashercodeorg about whether switching to use the |
|
SGTM (changing to use |
89f3be2 to
32a6748
Compare
| - if index # If an index was provided we're inside a LevelGroup. | ||
| :javascript | ||
| window['level_#{index}'] = { | ||
| window.levelGroup.questions[#{level.id}] = { |
There was a problem hiding this comment.
is this questions or answers?
There was a problem hiding this comment.
I originally named it results but Brendan suggested I call it something else: #7874 (comment). It's the collection of Multi/TextMatch/FreeResponse objects that provide a getCurrentAnswer method.
Open to suggestions for a better name!
There was a problem hiding this comment.
Hm, I was thinking levels (since a levelgroup is made out of levels in most places)... or is that name too overloaded?
Brent suggested storing individual level results on a single object in a new
levelGroupnamespace, instead of having multiple global vars.This PR also includes an optional change to store
LevelGroupattempts as a hash instead of an array.