Assistants have access to many procedures in the Exercise Management and Sheets section.
Parameter: Exercise Identifier
The assistant right grants access to the complete exercise tree with the corresponding id, from the Exercise Management and Sheets section.
changeAttributes(ident uid, ident id, string lecture, string term) { assume exists /account[uid]/admin || exists /account[uid]/assistant[id]; assume exists /exercise[id]; # implicitly true in OO implementations update /exercise[id]/lecture lecture; update /exercise[id]/term term; }
createSheet(ident uid, ident id, ident sheetId, double maxPoints) { assume exists /account[uid]/assistant[id]; assume exists /exercise[id]; assume not exists /exercise[id]/sheet[sheetId]; assume maxPoints >= 0; insert /exercise[id] <sheet id=[sheetId] maxPoints=[maxPoints] />; }
createGroup(ident uid, ident id, ident groupId, string day, string time, string location, integer maxSize) { assume exists /account[uid]/assistant[id]; assume exists /exercise[id]; assume not exists /exercise[id]/group[groupId]; assume maxSize >= 0; assume day = "Monday" || day = "Tuesday" || ...; insert /exercise[id] <group id=[groupId] day=[day] time=[time] location=[location] curSize=[0] maxSize=[maxSize] />; }
changeAttributes(ident uid, ident id, ident sheetId, double maxPoints) { assume exists /account[uid]/assistant[id]; assume exists /exercise[id]/sheet[sheetId]; # implies the existence of the exercise assume maxPoints >= 0; assume /exercise[id]/student[x]/result[sheetId]/points <= maxPoints; update /exercise[id]/sheet[sheetId]/maxPoints maxPoints; }
changeAttributes(ident uid, ident id, ident groupId, string day, string time, string location, integer maxSize) { assume exists /account[uid]/assistant[id]; assume exists /exercise[id]/group[groupId]; # implicitly true in OO implementations assume maxSize >= 0; assume /exercise[id]/group[groupId]/curSize <= maxSize; update /exercise[id]/group[groupId]/day day; update /exercise[id]/group[groupId]/time time; update /exercise[id]/group[groupId]/location location; update /exercise[id]/group[groupId]/maxSize maxSize; }
deleteSheet(ident uid, ident id, ident sheetId) { assume exists /account[uid]/assistant[id]; assume exists /exercise[id]/sheet[sheetId]; # implies existence of the exercise assume size(/exercise[id]/student/result[sheetId]) = 0; remove /exercise[id]/sheet[sheetId]; }
deleteGroup(ident uid, ident id, ident groupId) { assume exists /account[uid]/assistant[id]; assume exists /exercise[id]/group[groupId]; assume size(/exercise[id]/group[groupId]/tutor) = 0; assume count(groupId, /exercise[id]/student/group)) = 0; remove /exercise[id]/group[groupId]; }
grantTutorRights(ident uid, ident username, ident exerciseId, ident groupId) { assume exists /account[uid]/assistant[exerciseId]; assume exists /account[username]; # implicitly true in OO implementations assume exists /exercise[exerciseId]/group[groupId]; assume not exists /account[username]/tutor[exerciseId]/group[groupId]); assume not exists /exercise[exerciseId]/group[groupId]/tutor[username]; # implied by integrity and the assumption before if not exists /account[username]/tutor[exerciseId] then # we could split the tutor rights here insert /account[username] <tutor exercise=[exerciseId] />; fi insert /account[username]/tutor[exerciseId] <group id=[groupId] />; insert /exercise[exerciseId]/group[groupId] <tutor account=[account] />; }
revokeTutorRights(ident uid, ident username, ident exerciseId, ident groupId) { assume exists /account[uid]/assistant[exerciseId]; assume exists /account[username]/tutor[exerciseId]/group[groupId]; assume exists /exercise[exerciseId]/group[groupId]/tutor[username]; # implied by integrity and the assumption before remove /account[username]/tutor[exerciseId]/group[groupId]; if size(/account[username]/tutor[exerciseId]/group) = 0 then # should this be an additional procedure? remove /account[username]/tutor[exerciseId]; fi remove /exercise[exerciseId]/group[groupId]/tutor[username]; }
openSignUp(ident uid, ident id) { assume exists /account[uid]/assistant[id]; assume exists /exercise[id]; assume not /exercise[id]/open; update /exercise[id]/open true; }
closeSignUp(ident uid, ident id) { assume exists /account[uid]/assistant[id]; assume exists /exercise[id]; assume /exercise[id]/open; update /exercise[id]/open false; }
signUpGroup(ident uid, ident id, ident studentId, ident groupId) { assume exists /exercise[id] && /exercise[id]/open && 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 /exercise[id]/student[studentId]/group; assume /exercise[id]/group[groupId]/curSize < /exercise[id]/group[groupId]/maxSize; insert /exercise[id]/student[studentId]/group groupId; update /exercise[id]/group[groupId]/curSize (/exercise[id]/group[groupId]/curSize + 1); }
signOutGroup(ident uid, ident id, ident studentId) { assume exists /exercise[id] && /exercise[id]/open && exists /account[uid]/student && /account[uid]/student/id = studentId || exists /account[uid]/assistant[id]; assume exists /exercise[id]/student[studentId]/group; # implies existence of the exercise and student, even the group update /exercise[id]/group[/exercise[id]/student[studentId]/group]/curSize (/exercise[id]/group[/exercise[id]/student[studentId]/group]/curSize - 1) remove /exercise[id]/student[studentId]/group; }
signUpGroup(ident uid, ident id, ident studentId, ident groupId) { assume exists /exercise[id] && /exercise[id]/open && 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 /exercise[id]/student[studentId]/group; assume /exercise[id]/group[groupId]/curSize < /exercise[id]/group[groupId]/maxSize; insert /exercise[id]/student[studentId]/group groupId; update /exercise[id]/group[groupId]/curSize (/exercise[id]/group[groupId]/curSize + 1); }
signOutGroup(ident uid, ident id, ident studentId) { assume exists /exercise[id] && /exercise[id]/open && exists /account[uid]/student && /account[uid]/student/id = studentId || exists /account[uid]/assistant[id]; assume exists /exercise[id]/student[studentId]/group; # implies existence of the exercise and student, even the group update /exercise[id]/group[/exercise[id]/student[studentId]/group]/curSize (/exercise[id]/group[/exercise[id]/student[studentId]/group]/curSize - 1) remove /exercise[id]/student[studentId]/group; }
addResult(ident uid, ident id, ident studentId, ident sheetId, double points) { assume exists /account[uid]/assistant[id] || exists /account[uid]/tutor[id]/group[/exercise[id]/student[studentId]/group]; assume exists /exercise[id]/student[studentId]; # implies the existence of the exercise assume exists /exercise[id]/sheet[sheetId]; # dito assume not exists /exercise[id]/student[studentId]/result[sheetId]; assume points >= 0 && points <= /exercise[id]/sheet[sheetId]/maxPoints; insert /exercise[id]/student[studentId] <result sheet=[sheetId] points=[points] />; }
changeResult(ident uid, ident id, ident studentId, ident sheetId, double points) { assume exists /account[uid]/assistant[id] || exists /account[uid]/tutor[id]/group[/exercise[id]/student[studentId]/group]; assume exists /exercise[id]/student[studentId]; # implies the existence of the exercise assume exists /exercise[id]/sheet[sheetId]; # dito assume points >= 0 && points <= /exercise[id]/sheet[sheetId]/maxPoints; assume exists /exercise[id]/student[studentId]/result[sheetId]; update /exercise[id]/student[studentId]/result[sheetId]/points points; }
removeResult(ident uid, ident id, ident studentId, ident sheetId) { assume exists /account[uid]/assistant[id] || exists /account[uid]/tutor[id]/group[/exercise[id]/student[studentId]/group]; assume exists /exercise[id]/student[studentId]/result[sheetId]; # implies the existence of pretty much everything remove /exercise[id]/student[studentId]/result[sheetId]; }