Skip to content

Commit

Permalink
Merge pull request #580 from WorldBank-Transport/feature/cost-aggrega…
Browse files Browse the repository at this point in the history
…tion-checkbox-support

Add editor support for checkbox field aggregation
  • Loading branch information
Lucien Knechtli committed Jun 16, 2016
2 parents 43362e4 + 1f08a3a commit fad3a3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/data/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ def get_from_data(key):
obj = obj[key]
except KeyError:
raise ValidationError("The property '{}' does not exist on the schema".format(key))
choices = obj.get('enum', None)
items = obj.get('items', None)
if items:
choices = items.get('enum', None)
else:
choices = obj.get('enum', None)
if not choices:
raise ValidationError("The specified property must have choices (be an enum).")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@
}

function populateEnumFields() {
var fields = ctl.selectedPropertyKey.property.enum || ctl.selectedPropertyKey.property.items.enum;
ctl.enumFields = [];
_.forEach(ctl.selectedPropertyKey.property.enum, function(enumField) {
_.forEach(fields, function(enumField) {
ctl.enumFields.push({
field: enumField,
value: 0
Expand Down

0 comments on commit fad3a3c

Please sign in to comment.