This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
stats:proc:signupgroup [2011/09/28 20:34] Patrick Michel created |
stats:proc:signupgroup [2013/07/10 12:34] (current) |
||
---|---|---|---|
Line 2: | Line 2: | ||
<code xcend> | <code xcend> | ||
- | signUpGroup(ident id, ident studentId, ident groupId) { | + | signUpGroup(ident uid, ident id, ident studentId, ident groupId) { |
- | assume exists //exercises/exercise[id]/students/student[studentId]; # implies the existence of the exercise | + | assume exists /exercise[id] && /exercise[id]/open && |
- | assume exists //exercises/exercise[id]/groups/group[groupId]; # also implies it, but once is really enough | + | exists /account[uid]/student && /account[uid]/student/id = studentId |
+ | || exists /account[uid]/assistant[id]; | ||
+ | |||
+ | assume exists /exercise[id]/student[studentId]; # implies the existence of the exercise | ||
+ | assume exists /exercise[id]/group[groupId]; # also implies it, but once is really enough | ||
| | ||
- | assume not exists //exercises/exercise[id]/students/student[studentId]/group; | + | assume not exists /exercise[id]/student[studentId]/group; |
- | assume count(groupId, //exercises/exercise[id]/students/student/group) < //exercises/exercise[id]/groups/group[groupId]/maxSize; | + | assume /exercise[id]/group[groupId]/curSize < /exercise[id]/group[groupId]/maxSize; |
| | ||
- | insert //exercises/exercise[id]/students/student[studentId]/group groupId; | + | insert /exercise[id]/student[studentId]/group groupId; |
+ | update /exercise[id]/group[groupId]/curSize (/exercise[id]/group[groupId]/curSize + 1); | ||
} | } | ||
</code> | </code> |