User Tools

Site Tools


stats:role:student

Student Role

Students can not change much in the system, they can essentially just sign up or out for exercise, i.e. use procedures from Exercise Management and Sheets.

Parameter: Student ID

Access Rights

A student should see all the exercises from the Exercise Management and Sheets section, so he can sign up. He should also see all the exams in the Exam Management and Grades section, so he knows their details, but he doesn't sign up for them in our system.

Once he has a corresponding student or participant element in either, he can see his results and all the generic information, like sheets of exercises. In the Exercise Management and Sheets section, he can then also see all the groups. Registering in a group does not change visibility, however.

Procedures

Register for Exercise

registerStudent(ident uid, ident id, ident studentId) {
  assume count (studentId, /account/student/id) = 1;
 
  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];
  assume not exists /exercise[id]/student[studentId];
 
  insert /exercise[id] <student id=[studentId] />;
}
unregisterStudent(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]; # implies the exercise exists
 
  assume size(/exercise[id]/student[studentId]/result) = 0; # don't allow unregistering if results are there
  assume not exists /exercise[id]/student[studentId]/group; # don't allow if signed in a group
 
  remove /exercise[id]/student[studentId];
}

Group Sign-Up and Sign-Out

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;
}
stats/role/student.txt · Last modified: 2011/10/02 10:32 by Patrick Michel