forked from jeapostrophe/grade-samurai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.rkt
48 lines (46 loc) · 1.41 KB
/
model.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#lang racket/base
(require racket/date
racket/contract
racket/serialize)
(struct assignment (normal-weight optional-weight id due-secs eval-secs peer-secs questions)
#:prefab)
(struct question (normal-weight optional-weight prompt type)
#:prefab)
(struct student (nickname firstname lastname email)
#:prefab)
(struct answer (timestamp comments)
#:prefab)
(struct answer:bool answer (value)
#:prefab)
(struct answer:numeric answer (value)
#:prefab)
(provide/contract
[struct assignment
([normal-weight number?]
[optional-weight number?]
[id string?]
[due-secs number?]
[eval-secs number?]
[peer-secs (or/c false/c number?)]
[questions (listof question?)])]
[struct question
([normal-weight number?]
[optional-weight number?]
[prompt string?]
[type (or/c 'bool 'numeric)])]
[struct answer
([timestamp exact-nonnegative-integer?]
[comments string?])]
[struct answer:bool
([timestamp exact-nonnegative-integer?]
[comments string?]
[value boolean?])]
[struct answer:numeric
([timestamp exact-nonnegative-integer?]
[comments string?]
[value (between/c 0 1)])]
[struct student
([nickname string?]
[firstname string?]
[lastname string?]
[email string?])])