ucfopen / Materia

Engage students with easily embedded apps for online courses. Supercharge your course with compelling experiences and game mechanics.
https://ucfopen.github.io/Materia-Docs/
GNU Affero General Public License v3.0
36 stars 34 forks source link

Non-standard qSet data comes through in DevMateria but filtered out in actual Materia #856

Open zachberry opened 8 years ago

zachberry commented 8 years ago

With a demo.yaml example of:


---
name: Radar Grapher
qset:
  version: 1
  data:
    items:
      -
        materiaType: question
        id: null
        type: MC
        label: U
        min: Min
        max: Max
        questions:
          -
            text: How do you feel about U?
        answers:
          -
            text: '[No Answer]'
            value: 0

Inside DevMateria the exact same object comes through. However in docker Materia the label, min and max attributes are missing as they get filtered out. Putting them inside an options object works. Is this expected behavior? If so, is it possible to mimic this in DevMateria?

clpetersonucf commented 8 years ago

I ran into a similar experience while developing Adventure 2.0. Materia will only filter for certain qset attributes in each index of items, with only the options object able to contain non-standard attributes. DevMateria should definitely enforce that behavior, and possibly warn developers if they're not adhering to qset standards.

FrenjaminBanklin commented 7 years ago

Technically, each item in qset.items is handled in the Materia backend as a Materia/Widget_Question object (fuel/packages/materia/classes/widget/question.php). When an instance is saved each item in its qset is translated into an instance of this object, at which point only the properties explicitly defined (materiaType, id, type, created_at, questions, answers, options, assets) are actually pulled out of the data coming in from the creator.

Would it make more sense to have DevMateria's server-side code error and pass a warning back if it encounters nonstandard question properties? Or would it make more sense if the creator core knows which properties are standard and doesn't even bother saving if it encounters nonstandard properties?

FrenjaminBanklin commented 7 years ago

Added a solution for this to the new webpack version of DevMateria. Nonstandard qset item properties are stripped out before saving widget instance data, and warnings are passed back to the creator to be displayed as alerts.