Proposal for Choice Based Conditional Activities

Re: Proposal for Choice Based Conditional Activities

by sam marshall -
Number of replies: 0
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

OK, I like 'decision'...

Re these comments, I actually read the existing table definition now (note: course_modules_availability has full documentation visible in the xmldb editor doc view). This has some implications for things that should be a little different. Frankly this table seems like a slightly crappy design but I guess should stick with it at this point.

So you are correct, you don't need a new table, but the fields you need are slightly different. The current table is basically a 'target module A has a condition on source module B' table. So you don't need a new cmid field - existing sourcecmid is correct. However, you do need a new 'decision(s)' field.

If you like you could make this field a comma-separated list of decision strings (this could result in 'OR' processing). But with regard to the per-condition processing at a higher level than that, these conditions are boolean AND and should be kept that way for the moment unless we are going to change it for the other types of condition as well. (That's possible, and even maybe desirable, but I think better to do it as a separate change.)

In other words you can do conditions like:

Activity 'Species' must have decision 'Gecko'
AND
Activity 'Colour' must have value 'Green'
AND
Activity 'Colour' must be marked complete.
AND
Activity 'Status' must have one of the values 'Dead', 'Undead'.
AND
Activity 'Amphibian quiz' must have grade > 94%

Note that the lines are always ANDed together but within a decision line, you could make it be a list of multiple options.

For consistency I also think that contrary to my original suggestion, these rows of controls should be added exactly same as the current user interface for grade and completion conditions, that lets you add new rows (start with 1 row visible, they can click to add more). Given this interface you probably do need to do AJAX to pick the decision list (i.e. it starts off as a plain text input, but using JS, you hide it; then, when selection changes on the dropdown, you check that module using AJAX and either display nothing or else a listbox of options). I think this is what you said to start with so yes you were right, sorry.

--sam