# Graduation ## Table There exist a single table called `Graduation` to hold all graduation information. A single table is used to reduce the amount of requests required to load the data. It is important that only teachers are allowed to read from the table. ## Graduation Changes Graduation changes are unique and the systems ensures that no duplicates are entered. Changes can be active or archived. The state of a particular change is derived from subsequent changes. Currently multiple changes have to be retrieved to determine their state. This decision allows us to write data once and not modify changes in the future. The assumption is that a single person does not acquire that much changes, that this would be a performance issue. ### Database format Note that the database is a Moodle database activity and thus does not allow access using SQL. The below scheme uses a SQL like syntax. ```sql TABLE Change( Date: Date, Coach: String, Json: STRING, ) ``` The author of the change and the creation time are tracked by Moodle. ### Data format Each stored change is represented as JSON and has the following fields: (Fields marked by `?` are optional.) * `studentId` - the id of the student * `change` - the type of the change * `?reason` - the type of the change * `?context` - arbitrary data used to handle the type of change ### Changes Valid changes are: * `Grün` - sign for wanted behavior * `Orange` - sign for unwanted behavior * `Rot` - sign for unacceptable behavior * `LevelÄnderung` - the student's level changed * `CoachZuweisung` - one or more assignments of coaches to students #### Mandatory Changes Changes can be marked as mandatory by adding `mandatory: true` to its context. #### Green Mark Green marks are collectables. Green Marks are archived by a level change. #### Orange Mark Orange Marks are archived by a level change. #### Red Mark Red Marks are archived by a level change. #### LevelÄnderung Changes the level of a student to the value specified in `context.level`. #### CoachZuweisung A coach assignment change has the special studentId `-2` and may specify any number of studentIds mapped to a coach name. ```json {"zuweisungen": {1337: "Coachy Mc Coachface"}} ```