Skip to content

Commit ad8f85b

Browse files
committed
Add Graph.get_assessment_rules()
This should facilitate dynamic rule display for the various graph types.
1 parent d3eb196 commit ad8f85b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

econplayground/main/models.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,46 @@ def clone(self):
404404
g.save()
405405
return g
406406

407+
def get_assessment_rules(self):
408+
line_actions = [
409+
'up',
410+
'down',
411+
'slope up',
412+
'slope down',
413+
]
414+
415+
rules = {
416+
'line1': {
417+
'name': 'Orange line',
418+
'possible_values': line_actions,
419+
},
420+
421+
'line2': {
422+
'name': 'Blue line',
423+
'possible_values': line_actions,
424+
},
425+
426+
'line1 label': 'Orange line label',
427+
'line2 label': 'Blue line label',
428+
'intersectionLabel': 'Intersection label',
429+
'intersectionHorizLineLabel':
430+
'Orange-Blue intersection horizontal',
431+
'intersectionVertLineLabel': 'Orange-Blue intersection vertical',
432+
'x-axis label': 'X-axis label',
433+
'y-axis label': 'Y-axis label',
434+
}
435+
436+
# TODO: extend possible rules for the various other graph types
437+
if self.graph_type == 8:
438+
rules.update({
439+
'line3': {
440+
'name': 'Green line',
441+
'possible_values': line_actions,
442+
}
443+
})
444+
445+
return rules
446+
407447

408448
class JXGLine(models.Model):
409449
class Meta:

0 commit comments

Comments
 (0)