mirror of https://github.com/dirtbags/moth.git
Allow arbitrary metadata on puzzles
This commit is contained in:
parent
124b879f03
commit
6a6860b5da
|
@ -8,10 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Changed
|
||||
- Answer hashes are now the first 4 characters of the hex-encoded SHA1 digest
|
||||
- Reworked the built-in theme
|
||||
- [moth.mjs](theme/moth.mjs) is now the standard MOTH library for ECMAScript
|
||||
- Devel mode no longer accepts an empty team ID
|
||||
- messages.html moved into theme
|
||||
|
||||
### Added
|
||||
- [moth.mjs](theme/moth.mjs) is now the standard MOTH library for ECMAScript
|
||||
- Exported state now includes "Enabled" boolean
|
||||
- New `Extra` field on puzzles will allow addition of arbitrary fields to be attached to puzzles.
|
||||
PNNL's SCTR Osprey will use this to standardize fields for their custom theme,
|
||||
but it can be generally used for anything.
|
||||
|
||||
## [v4.4.11] - 2023-04-11
|
||||
### Changed
|
||||
|
|
|
@ -60,6 +60,13 @@ type Puzzle struct {
|
|||
// AnswerHashes contains hashes of all answers for this puzzle
|
||||
AnswerHashes []string
|
||||
|
||||
// Answers lists all acceptable answers, omitted in mothballs
|
||||
Answers []string
|
||||
|
||||
// Extra is send unchanged to the client.
|
||||
// Eventually, Objective, KSAs, and Success will move into Extra.
|
||||
Extra map[string]any
|
||||
|
||||
// Objective is the learning objective for this puzzle
|
||||
Objective string
|
||||
|
||||
|
@ -74,9 +81,6 @@ type Puzzle struct {
|
|||
// Mastery describes the work required to be considered mastering this puzzle's conceptss
|
||||
Mastery string
|
||||
}
|
||||
|
||||
// Answers lists all acceptable answers, omitted in mothballs
|
||||
Answers []string
|
||||
}
|
||||
|
||||
func (puzzle *Puzzle) computeAnswerHashes() {
|
||||
|
|
|
@ -178,11 +178,17 @@ class Puzzle {
|
|||
this.Answers ||= []
|
||||
this.Attachments ||= []
|
||||
this.Authors ||= []
|
||||
this.Scripts ||= []
|
||||
this.Debug ||= {}
|
||||
this.Debug.Errors ||= []
|
||||
this.Debug.Hints ||= []
|
||||
this.Debug.Log ||= []
|
||||
this.KSAs ||= []
|
||||
this.Scripts ||= []
|
||||
this.Extra ||= {}
|
||||
|
||||
// Be ready to handle a future revision to the Puzzle structure
|
||||
this.Objective ||= this.Extra.Objective
|
||||
this.KSAs ||= this.Extra.KSAs || []
|
||||
this.Success ||= this.Extra.Success || {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue