This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
stats:proc:removeparticipant [2011/09/27 20:54] Patrick Michel created |
stats:proc:removeparticipant [2013/07/10 12:34] (current) |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| <code xcend> | <code xcend> | ||
| - | removeParticipant(ident id, ident studentId) { | + | removeParticipant(ident uid, ident id, ident studentId) { |
| - | assume exists //exams/exam[id]/results/participant[studentId]; # implies the exam exists, which is implicitly true anyway | + | assume exists /account[uid]/student && /account[uid]/student/id = studentId && /exam[id]/free |
| + | || exists /account[uid]/examiner[id]; | ||
| - | remove //exams/exam[id]/results/participant[studentId]; | + | assume exists /exam[id]/participant[studentId]; # implies the exam exists, which is implicitly true anyway |
| + | |||
| + | assume size(/exam[id]/participant[studentId]/result) = 0; # don't allow to remove if results are there | ||
| + | |||
| + | remove /exam[id]/participant[studentId]; | ||
| } | } | ||
| </code> | </code> | ||