Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
48b90432
Commit
48b90432
authored
Dec 05, 2012
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial problem list functionality
parent
7596deb4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
29 deletions
+64
-29
lms/static/coffee/src/staff_grading/staff_grading.coffee
+64
-29
No files found.
lms/static/coffee/src/staff_grading/staff_grading.coffee
View file @
48b90432
...
@@ -36,19 +36,20 @@ class StaffGradingBackend
...
@@ -36,19 +36,20 @@ class StaffGradingBackend
else
if
cmd
==
'save_grade'
else
if
cmd
==
'save_grade'
console
.
log
(
"eval:
#{
data
.
score
}
pts, Feedback:
#{
data
.
feedback
}
"
)
console
.
log
(
"eval:
#{
data
.
score
}
pts, Feedback:
#{
data
.
feedback
}
"
)
response
=
response
=
@
mock
(
'get_next'
,
{})
@
mock
(
'get_next'
,
{
location
})
# get_prob
b
lem_list
# get_problem_list
# sends in a course_id and a grader_id
# sends in a course_id and a grader_id
# should get back a list of problem_ids, problem_names, num_left, num_total
# should get back a list of problem_ids, problem_names, num_left, num_total
else
if
cmd
==
'get_problem_list'
else
if
cmd
==
'get_problem_list'
response
=
@
mock_cnt
++
success
:
true
response
=
problem_list
:
[
success
:
true
{
location
:
'i4x://MITx/3.091x/problem/open_ended_demo'
,
\
problem_list
:
[
problem_name
:
"Problem 1"
,
num_left
:
3
,
num_total
:
5
},
{
location
:
'i4x://MITx/3.091x/problem/open_ended_demo'
,
\
{
location
:
'i4x://MITx/3.091x/problem/open_ended_demo'
,
\
problem_name
:
"Problem 1"
,
num_left
:
3
,
num_total
:
5
},
problem_name
:
"Problem 2"
,
num_left
:
1
,
num_total
:
5
}
{
location
:
'i4x://MITx/3.091x/problem/open_ended_demo'
,
\
]
problem_name
:
"Problem 2"
,
num_left
:
1
,
num_total
:
5
}
]
else
else
response
=
response
=
success
:
false
success
:
false
...
@@ -79,8 +80,13 @@ class StaffGradingBackend
...
@@ -79,8 +80,13 @@ class StaffGradingBackend
class
StaffGrading
class
StaffGrading
constructor
:
(
backend
)
->
constructor
:
(
backend
)
->
@
backend
=
backend
@
backend
=
backend
@
list_view
=
true
# all the jquery selectors
# all the jquery selectors
@
problem_list_container
=
$
(
'.problem-list-container'
)
@
problem_list
=
$
(
'.problem-list'
)
@
error_container
=
$
(
'.error-container'
)
@
error_container
=
$
(
'.error-container'
)
@
message_container
=
$
(
'.message-container'
)
@
message_container
=
$
(
'.message-container'
)
...
@@ -108,17 +114,19 @@ class StaffGrading
...
@@ -108,17 +114,19 @@ class StaffGrading
@
message
=
''
@
message
=
''
@
max_score
=
0
@
max_score
=
0
@
ml_error_info
=
''
@
ml_error_info
=
''
@
location
=
''
@
score
=
null
@
score
=
null
@
problems
=
null
# action handlers
# action handlers
@
submit_button
.
click
@
submit
@
submit_button
.
click
@
submit
# render intial state
# render intial state
@
render_view
()
#
@render_view()
# send initial request automatically
# send initial request automatically
@
get_
next_submission
()
@
get_
problem_list
()
setup_score_selection
:
=>
setup_score_selection
:
=>
...
@@ -153,7 +161,9 @@ class StaffGrading
...
@@ -153,7 +161,9 @@ class StaffGrading
@
message
=
''
@
message
=
''
if
response
.
success
if
response
.
success
if
response
.
submission
if
response
.
problem_list
@
problems
=
response
.
problem_list
else
if
response
.
submission
@
data_loaded
(
response
.
prompt
,
response
.
submission
,
response
.
rubric
,
response
.
submission_id
,
response
.
max_score
,
response
.
ml_error_info
)
@
data_loaded
(
response
.
prompt
,
response
.
submission
,
response
.
rubric
,
response
.
submission_id
,
response
.
max_score
,
response
.
ml_error_info
)
else
else
@
no_more
(
response
.
message
)
@
no_more
(
response
.
message
)
...
@@ -162,8 +172,13 @@ class StaffGrading
...
@@ -162,8 +172,13 @@ class StaffGrading
@
render_view
()
@
render_view
()
get_next_submission
:
()
->
get_next_submission
:
(
location
)
->
@
backend
.
post
(
'get_next'
,
{},
@
ajax_callback
)
@
location
=
location
@
list_view
=
false
@
backend
.
post
(
'get_next'
,
{
location
},
@
ajax_callback
)
get_problem_list
:
()
->
@
backend
.
post
(
'get_problem_list'
,
{},
@
ajax_callback
)
submit_and_get_next
:
()
->
submit_and_get_next
:
()
->
data
=
data
=
...
@@ -202,14 +217,41 @@ class StaffGrading
...
@@ -202,14 +217,41 @@ class StaffGrading
@
state
=
state_no_data
@
state
=
state_no_data
render_view
:
()
->
render_view
:
()
->
# make the view elements match the state. Idempotent.
# clear the problem list
show_grading_elements
=
false
@
problem_list
.
html
(
''
)
show_submit_button
=
true
@
message_container
.
html
(
@
message
)
@
message_container
.
html
(
@
message
)
# only show the grading elements when we are not in list view or the state
# is invalid
show_grading_elements
=
!
(
@
list_view
||
@
state
==
state_error
||
@
state
==
state_no_data
)
@
prompt_wrapper
.
toggle
(
show_grading_elements
)
@
submission_wrapper
.
toggle
(
show_grading_elements
)
@
rubric_wrapper
.
toggle
(
show_grading_elements
)
@
ml_error_info_container
.
toggle
(
show_grading_elements
)
@
submit_button
.
hide
()
if
@
backend
.
mock_backend
if
@
backend
.
mock_backend
@
message_container
.
append
(
"<p>NOTE: Mocking backend.</p>"
)
@
message_container
.
append
(
"<p>NOTE: Mocking backend.</p>"
)
if
@
list_view
@
render_list
()
else
@
render_problem
()
problem_link
:
(
problem
)
->
link
=
$
(
'<a>'
).
attr
(
'href'
,
"javascript:void(0)"
).
append
(
"
#{
problem
.
problem_name
}
(
#{
problem
.
num_left
}
/
#{
problem
.
num_total
}
)"
)
.
click
=>
@
get_next_submission
problem
.
location
render_list
:
()
->
for
problem
in
@
problems
@
problem_list
.
append
(
$
(
'<li>'
).
append
(
@
problem_link
(
problem
)))
render_problem
:
()
->
# make the view elements match the state. Idempotent.
show_submit_button
=
true
@
error_container
.
html
(
@
error_msg
)
@
error_container
.
html
(
@
error_msg
)
if
@
state
==
state_error
if
@
state
==
state_error
...
@@ -220,7 +262,6 @@ class StaffGrading
...
@@ -220,7 +262,6 @@ class StaffGrading
@
prompt_container
.
html
(
@
prompt
)
@
prompt_container
.
html
(
@
prompt
)
@
submission_container
.
html
(
@
submission
)
@
submission_container
.
html
(
@
submission
)
@
rubric_container
.
html
(
@
rubric
)
@
rubric_container
.
html
(
@
rubric
)
show_grading_elements
=
true
# no submit button until user picks grade.
# no submit button until user picks grade.
show_submit_button
=
false
show_submit_button
=
false
...
@@ -228,7 +269,6 @@ class StaffGrading
...
@@ -228,7 +269,6 @@ class StaffGrading
@
setup_score_selection
()
@
setup_score_selection
()
else
if
@
state
==
state_graded
else
if
@
state
==
state_graded
show_grading_elements
=
true
@
set_button_text
(
'Submit'
)
@
set_button_text
(
'Submit'
)
else
if
@
state
==
state_no_data
else
if
@
state
==
state_no_data
...
@@ -239,21 +279,16 @@ class StaffGrading
...
@@ -239,21 +279,16 @@ class StaffGrading
@
error
(
'System got into invalid state '
+
@
state
)
@
error
(
'System got into invalid state '
+
@
state
)
@
submit_button
.
toggle
(
show_submit_button
)
@
submit_button
.
toggle
(
show_submit_button
)
@
prompt_wrapper
.
toggle
(
show_grading_elements
)
@
submission_wrapper
.
toggle
(
show_grading_elements
)
@
rubric_wrapper
.
toggle
(
show_grading_elements
)
@
ml_error_info_container
.
toggle
(
show_grading_elements
)
submit
:
(
event
)
=>
submit
:
(
event
)
=>
event
.
preventDefault
()
event
.
preventDefault
()
if
@
state
==
state_error
if
@
state
==
state_error
@
get_next_submission
()
@
get_next_submission
(
@
location
)
else
if
@
state
==
state_graded
else
if
@
state
==
state_graded
@
submit_and_get_next
()
@
submit_and_get_next
()
else
if
@
state
==
state_no_data
else
if
@
state
==
state_no_data
@
get_next_submission
()
@
get_next_submission
(
@
location
)
else
else
@
error
(
'System got into invalid state for submission: '
+
@
state
)
@
error
(
'System got into invalid state for submission: '
+
@
state
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment