Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.

Commit 1593ac2

Browse files
committed
⚒️make assignment status more intuitive and user friendly
* Do not mix progress and grading columns and terms * Change some headings and titles * Make it clear that it is the student’s responsibility to track status
1 parent 56cfa39 commit 1593ac2

File tree

5 files changed

+136
-65
lines changed

5 files changed

+136
-65
lines changed

controllers/assignments.py

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ def update_submit():
550550
assignment_id = (
551551
request.vars.assignment_id
552552
) # used to grab the data from jQuery request
553-
student_id = request.vars.student_id
553+
student_id = auth.user.id
554554
# pull the grades table for the current student
555555
grade = (
556556
db(
@@ -560,17 +560,23 @@ def update_submit():
560560
.select()
561561
.first()
562562
)
563+
if request.vars.new_state:
564+
is_submit = request.vars.new_state
565+
else:
566+
is_submit = None
563567

564568
res = {}
565569

566570
if grade:
567571
# toggles the is_submit variable from True to False
568-
if grade.is_submit == "In Progress":
569-
is_submit = "Complete"
570-
elif grade.is_submit == "Complete":
571-
is_submit = "Not Started"
572-
else:
573-
is_submit = "In Progress"
572+
# keep this clause for backward compatibility
573+
if is_submit is None:
574+
if grade.is_submit == "In Progress":
575+
is_submit = "Complete"
576+
elif grade.is_submit == "Complete":
577+
is_submit = "Not Started"
578+
else:
579+
is_submit = "In Progress"
574580

575581
db.grades.update_or_insert(
576582
(db.grades.auth_user == student_id)
@@ -912,7 +918,9 @@ def chooseAssignment():
912918
timezoneoffset = parsed_js.get("tz_offset", None)
913919

914920
status = [] # This will be used to show the status of each assignment on html file
921+
score = []
915922
duedates = [] # This will be used to display the due date for each assignment
923+
ontime = []
916924

917925
course = db(db.courses.id == auth.user.course_id).select().first()
918926
assignments = db(
@@ -951,10 +959,18 @@ def chooseAssignment():
951959
percent_grade = 0.0
952960
percent_grade = 100 * grade.score / assignment.points
953961
if percent_grade % 10 == 0:
954-
status.append(str(int(percent_grade)) + "%")
962+
score.append(str(int(percent_grade)) + "%")
955963
else:
956-
status.append("{0:.1f}%".format(percent_grade))
957-
elif grade.is_submit:
964+
score.append("{0:.1f}%".format(percent_grade))
965+
else:
966+
score.append("Not Graded")
967+
968+
if deadline <= datetime.datetime.utcnow() and grade.is_submit != "Complete":
969+
ontime.append(False)
970+
else:
971+
ontime.append(True)
972+
973+
if grade.is_submit:
958974
status.append(grade.is_submit)
959975
elif timestamp > deadline and assignment.enforce_due:
960976
status.append("Past Due")
@@ -972,8 +988,10 @@ def chooseAssignment():
972988
assignments=assignments,
973989
status=status,
974990
duedates=duedates,
991+
score=score,
975992
course_id=auth.user.course_name,
976993
course=course,
994+
ontime=ontime,
977995
)
978996

979997

static/js/markcomplete.js

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,44 @@
11
function markComplete(assignment_id, student_id) {
2+
// This function is deprecated as of December 2022
23
jQuery.ajax({
34
url: eBookConfig.app + '/assignments/update_submit',
45
type: "POST",
56
dataType: "JSON",
67
data: {
78
assignment_id: assignment_id,
8-
student_id:student_id
9+
student_id: student_id
910
},
10-
success: function (retdata) {
11+
success: function(retdata) {
1112
window.location.reload(true);
1213
}
1314
});
14-
}
15+
}
16+
17+
18+
19+
async function updateAssignmentProgress (newState, assignmentId) {
20+
21+
let data = {
22+
assignment_id: assignmentId,
23+
new_state: newState,
24+
};
25+
let jsheaders = new Headers({
26+
"Content-type": "application/json; charset=utf-8",
27+
Accept: "application/json",
28+
});
29+
let request = new Request(`${eBookConfig.app}/assignments/update_submit`, {
30+
method: "POST",
31+
headers: jsheaders,
32+
body: JSON.stringify(data),
33+
});
34+
let resp = await fetch(request);
35+
if (!resp.ok) {
36+
alert(`Status Not Updated ${resp.statusText}`);
37+
} else {
38+
if (location.href.indexOf("doAssignment") > -1) {
39+
window.location.reload(true);
40+
}
41+
}
42+
43+
console.log(newState);
44+
}

views/_sphinx_static_files.html

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -63,39 +63,53 @@
6363
<script src="{{=URL('static', 'js/jquery.datetimepicker.full.min.js')}}"></script>
6464
<link rel="stylesheet" type="text/css" href="{{=URL('static', 'jquery.datetimepicker.min.css')}}" />
6565

66-
<script type="text/x-mathjax-config">
67-
MathJax.Hub.Config({
68-
tex2jax: {
69-
inlineMath: [['\\(','\\)']]
70-
},
71-
asciimath2jax: {
72-
ignoreClass: ".*",
73-
processClass: "has_am"
74-
},
75-
jax: ["input/AsciiMath"],
76-
extensions: ["asciimath2jax.js"],
77-
TeX: {
78-
extensions: ["extpfeil.js", "autobold.js", "https://pretextbook.org/js/lib/mathjaxknowl.js", "AMScd.js", ],
79-
// scrolling to fragment identifiers is controlled by other Javascript
80-
positionToHash: false,
81-
equationNumbers: { autoNumber: "none", useLabelIds: true, },
82-
TagSide: "right",
83-
TagIndent: ".8em",
84-
Macros: { },
85-
},
86-
// HTML-CSS output Jax to be dropped for MathJax 3.0
87-
"HTML-CSS": {
88-
scale: 88,
89-
mtextFontInherit: true,
90-
},
91-
CommonHTML: {
92-
scale: 88,
93-
mtextFontInherit: true,
94-
},
95-
});
66+
<script>
67+
var runestoneMathReady = new Promise((resolve) => window.rsMathReady = resolve);
68+
window.MathJax = {
69+
tex: {
70+
inlineMath: [['\\(','\\)']],
71+
tags: "none",
72+
tagSide: "right",
73+
tagIndent: ".8em",
74+
packages: {'[+]': ['base', 'extpfeil', 'ams', 'amscd', 'newcommand', 'knowl']}
75+
},
76+
options: {
77+
ignoreHtmlClass: "tex2jax_ignore|ignore-math",
78+
processHtmlClass: "process-math",
79+
renderActions: {
80+
findScript: [10, function (doc) {
81+
document.querySelectorAll('script[type^="math/tex"]').forEach(function(node) {
82+
var display = !!node.type.match(/; *mode=display/);
83+
var math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
84+
var text = document.createTextNode('');
85+
node.parentNode.replaceChild(text, node);
86+
math.start = {node: text, delim: '', n: 0};
87+
math.end = {node: text, delim: '', n: 0};
88+
doc.math.push(math);
89+
});
90+
}, '']
91+
},
92+
},
93+
chtml: {
94+
scale: 0.88,
95+
mtextInheritFont: true
96+
},
97+
loader: {
98+
load: ['input/asciimath', '[tex]/extpfeil', '[tex]/amscd', '[tex]/newcommand', '[pretext]/mathjaxknowl3.js'],
99+
paths: {pretext: "https://pretextbook.org/js/lib"},
100+
},
101+
startup: {
102+
pageReady() {
103+
return MathJax.startup.defaultPageReady().then(function () {
104+
console.log("in ready function");
105+
rsMathReady();
106+
}
107+
)}
108+
},
109+
};
96110
</script>
97111

98-
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
112+
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
99113

100114

101115
<style>

views/assignments/chooseAssignment.html

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,37 @@
22

33
{{block moreincludes}}
44
{{include '_sphinx_static_files.html'}}
5+
<script src="/runestone/static/js/markcomplete.js" type="text/javascript"></script>
56
{{end}}
67

78
<h1>Assignments</h1><h2></h2>
89
<table class="table table-striped">
9-
<tr><th>Name</th><th>Status</th><th>Due</th><th>Description</th></tr>
10+
<tr><th>Name</th><th>My Progress</th><th>Due</th><th>Score<th>Description</th></tr>
1011
{{i=0}}
1112
{{for assignment in assignments:}}
1213
<tr>
1314
<td><a href="doAssignment?assignment_id={{=assignment['id']}}">{{=assignment['name']}}</a></td>
14-
<th>{{=status[i]}}</th>
15-
<td>{{=duedates[i]}}</td>
15+
<th>
16+
<select onchange="updateAssignmentProgress(this.value, {{=assignment['id']}})">
17+
{{for option in ["Not Started", "In Progress", "Complete"]:}}
18+
<option
19+
{{ if status[i] == option: }}
20+
selected
21+
{{ pass }}
22+
value="{{=option}}"
23+
>{{=option}}
24+
</option>
25+
{{pass}}
26+
</select>
27+
</th>
28+
{{ if ontime[i]:}}
29+
<td>{{=duedates[i]}}</td>
30+
{{else:}}
31+
<td style="color: red">{{=duedates[i]}}</td>
32+
{{pass}}
33+
<td>
34+
{{=score[i]}}
35+
</td>
1636
<td>{{=assignment['description']}}</td>
1737
{{i+=1}}
1838
</tr>

views/assignments/doAssignment.html

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ <h2 style='margin-left:1cm;'>Due: {{=assignment['duedate']}}</h2>
2424
<div>
2525
{{if is_submit == "Complete" or is_graded or enforce_pastdue:}}
2626
<div style='background-color:rgb(146, 207, 165); margin-left:2cm; margin-right:2cm;'>
27-
<p style='margin-left:0.5cm; margin-right:0.5cm;'>This assignment has been submitted</p>
27+
<p style='margin-left:0.5cm; margin-right:0.5cm;'>You have marked this assignment Complete. Click to mark it <button onclick="updateAssignmentProgress('In Progress', assignmentId)" class="btn btn-info">In Progress</button></p>
2828
</div>
2929
{{elif is_submit == "In Progress":}}
3030
<div style='background-color:rgb(247, 238, 158); margin-left:2cm; margin-right:2cm;'>
31-
<p style='margin-left:0.5cm; margin-right:0.5cm;'>This assignment is in progress</p>
31+
<p style='margin-left:0.5cm; margin-right:0.5cm;'>You have marked this assignment as In Progress. Click to mark it as <button onclick="updateAssignmentProgress('Complete', assignmentId)" class="btn btn-info">Complete</button></p>
3232
</div>
3333
{{else:}}
3434
<div style='background-color:rgb(236, 189, 189); margin-left:2cm; margin-right:2cm;'>
35-
<p style='margin-left:0.5cm; margin-right:0.5cm;'>This assignment has not been started</p>
35+
<p style='margin-left:0.5cm; margin-right:0.5cm;'>You can mark this assignment as <button onclick="updateAssignmentProgress('In Progress', assignmentId)" class="btn btn-info">In Progress</button> by clicking the button.</p>
3636
</div>
3737
{{pass}}
3838
</div>
@@ -125,7 +125,7 @@ <h5 style='text-align:center;'>Not yet graded</h5>
125125
<div>
126126
{{if is_submit == "Complete" or is_graded or enforce_pastdue:}}
127127
<div style='background-color:rgb(146, 207, 165); margin-left:2cm; margin-right:2cm;'>
128-
<p style='margin-left:0.5cm; margin-right:0.5cm;'>This assignment has been submitted</p>
128+
<p style='margin-left:0.5cm; margin-right:0.5cm;'>You have marked this assignment Complete. Click to mark it <button onclick="updateAssignmentProgress('In Progress', assignmentId)" class="btn btn-info">In Progress</button></p>
129129
</div>
130130
{{if is_graded:}}
131131
<div style='background-color:powderblue; margin-left:2cm; margin-right:2cm;'>
@@ -141,29 +141,18 @@ <h5 style='text-align:center;'>Not yet graded</h5>
141141
{{pass}}
142142
{{elif is_submit == "In Progress":}}
143143
<div style='background-color:rgb(247, 238, 158); margin-left:2cm; margin-right:2cm;'>
144-
<p style='margin-left:0.5cm; margin-right:0.5cm;'>This assignment is in progress</p>
144+
<p style='margin-left:0.5cm; margin-right:0.5cm;'>You have marked this assignment as In Progress. Click to mark it as <button onclick="updateAssignmentProgress('Complete', assignmentId)" class="btn btn-info">Complete</button></p>
145145
</div>
146146
{{else:}}
147147
<div style='background-color:rgb(236, 189, 189); margin-left:2cm; margin-right:2cm;'>
148-
<p style='margin-left:0.5cm; margin-right:0.5cm;'>This assignment has not been started</p>
148+
<p style='margin-left:0.5cm; margin-right:0.5cm;'>You can mark this assignment as <button onclick="updateAssignmentProgress('In Progress', assignmentId)" class="btn btn-info">In Progress</button> by clicking the button.</p>
149149
</div>
150150
{{pass}}
151151
</div>
152152

153153
{{ if not released and not assignment.is_timed: }}
154154
<div style="text-align:center">
155-
<button class="btn btn-lg buttonAskCompletion" id="gradeMeButton">Score Me</button>
156-
{{if not is_graded and not enforce_pastdue:}}
157-
<button class="btn btn-lg buttonAskCompletion" id="submitMeButton">
158-
{{if is_submit == "Not Started":}}
159-
Mark In Progress
160-
{{elif is_submit == "In Progress":}}
161-
Mark Complete
162-
{{else:}}
163-
Mark Incomplete
164-
{{pass}}
165-
</button>
166-
{{pass}}
155+
<button class="btn btn-lg buttonAskCompletion" id="gradeMeButton">Compute Score for Assignment</button>
167156
<p><strong>Warning:</strong> Scores for problems that you self grade are unofficial.
168157
Some problems will need to be manually graded, and your instructor may have requirements that cannot be autograded.
169158
No deadlines are enforced when self grading, but your instructor may penalize you

0 commit comments

Comments
 (0)