Newer
Older
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
# -*- coding: utf-8 -*-
from __future__ import division
__copyright__ = "Copyright (C) 2014 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
class user_status:
unconfirmed = "unconfirmed"
active = "active"
USER_STATUS_CHOICES = (
(user_status.unconfirmed, "Unconfirmed"),
(user_status.active, "Active"),
)
class participation_role:
instructor = "instructor"
teaching_assistant = "ta"
student = "student"
# can see analytics
observer = "observer"
unenrolled = "unenrolled"
PARTICIPATION_ROLE_CHOICES = (
(participation_role.instructor, "Instructor"),
(participation_role.teaching_assistant, "Teaching Assistant"),
(participation_role.student, "Student"),
# unenrolled is only used internally
)
class participation_status:
requested = "requested"
active = "active"
dropped = "dropped"
denied = "denied"
PARTICIPATION_STATUS_CHOICES = (
(participation_status.requested, "Requested"),
(participation_status.active, "Active"),
(participation_status.dropped, "Dropped"),
(participation_status.denied, "Denied"),
)
class flow_session_expriration_mode:
# always allowed
# allowed by special permission below
roll_over = "roll_over"
FLOW_SESSION_EXPIRATION_MODE_CHOICES = (
(flow_session_expriration_mode.end, "End session and grade"),
(flow_session_expriration_mode.roll_over,
"Keep session and apply new rules"),
)
def is_expiration_mode_allowed(expmode, permissions):
if expmode == flow_session_expriration_mode.roll_over:
if (flow_permission.set_roll_over_expiration_mode
in permissions):
return True
elif expmode == flow_session_expriration_mode.end:
return True
else:
raise ValueError("unknown expiration mode")
return False
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
"""
.. attribute:: view
.. attribute:: view_past
.. attribute:: start_credit
.. attribute:: start_no_credit
.. attribute:: change_answer
Grants permission to change an already-graded answer,
which may then be graded again. Useful for
:class:`course.page.PythonCodeQuestion` to allow
iterative debugging.
.. attribute:: see_correctness
.. attribute:: see_correctness_after_completion
.. attribute:: see_answer
.. attribute:: see_answer_after_completion
.. attribute:: set_roll_over_expiration_mode
Grants permission to let a student choose to let a flow
"expire" into the then-current set of access rules
instead of into being submitted for grading.
See :ref:`flow-life-cycle`.
"""
view = "view"
view_past = "view_past"
start_credit = "start_credit"
start_no_credit = "start_no_credit"
change_answer = "change_answer"
see_correctness = "see_correctness"
see_correctness_after_completion = "see_correctness_after_completion"
see_answer = "see_answer"
see_answer_after_completion = "see_answer_after_completion"
set_roll_over_expiration_mode = "set_roll_over_expiration_mode"
FLOW_PERMISSION_CHOICES = (
(flow_permission.view, "View the flow"),
(flow_permission.view_past, "Review past attempts"),
(flow_permission.start_credit, "Start a for-credit session"),
(flow_permission.start_no_credit, "Start a not-for-credit session"),
(flow_permission.change_answer, "Change already-graded answer"),
(flow_permission.see_correctness, "See whether an answer is correct"),
(flow_permission.see_correctness_after_completion,
"See whether an answer is correct after completing the flow"),
(flow_permission.see_answer, "See the correct answer"),
(flow_permission.see_answer_after_completion,
"See the correct answer after completing the flow"),
(flow_permission.set_roll_over_expiration_mode,
"Set the session to 'roll over' expiration mode"),
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
)
class grade_aggregation_strategy:
max_grade = "max_grade"
avg_grade = "avg_grade"
min_grade = "min_grade"
use_earliest = "use_earliest"
use_latest = "use_latest"
GRADE_AGGREGATION_STRATEGY_CHOICES = (
(grade_aggregation_strategy.max_grade, "Use the max grade"),
(grade_aggregation_strategy.avg_grade, "Use the avg grade"),
(grade_aggregation_strategy.min_grade, "Use the min grade"),
(grade_aggregation_strategy.use_earliest, "Use the earliest grade"),
(grade_aggregation_strategy.use_latest, "Use the latest grade"),
)
class grade_state_change_types:
grading_started = "grading_started"
graded = "graded"
retrieved = "retrieved"
unavailable = "unavailable"
extension = "extension"
report_sent = "report_sent"
do_over = "do_over"
exempt = "exempt"
GRADE_STATE_CHANGE_CHOICES = (
(grade_state_change_types.grading_started, 'Grading started'),
(grade_state_change_types.graded, 'Graded'),
(grade_state_change_types.retrieved, 'Retrieved'),
(grade_state_change_types.unavailable, 'Unavailable'),
(grade_state_change_types.extension, 'Extension'),
(grade_state_change_types.report_sent, 'Report sent'),
(grade_state_change_types.do_over, 'Do-over'),
(grade_state_change_types.exempt, 'Exempt'),
)