adding in progress functionality
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
$(document).on('click', 'section.sa-wrapper input#show', ( ->
|
||||
root = location.protocol + "//" + location.host
|
||||
post_url=$('section.sa-wrapper input#show').attr('url')
|
||||
alert(post_url)
|
||||
final_url="/courses/MITx/6.002x/2012_Fall/modx/#{post_url}/sa_show"
|
||||
alert(final_url)
|
||||
answer=$('section.sa-wrapper input#answer').val()
|
||||
|
||||
$.post final_url, answer, (response) ->
|
||||
if response.success
|
||||
$('p.rubric').replace(response.rubric)
|
||||
alert("posted")
|
||||
if response.success
|
||||
alert(response.rubric)
|
||||
$('section.sa-wrapper p#rubric').replace(response.rubric)
|
||||
|
||||
alert("save")
|
||||
));
|
||||
@@ -33,13 +34,3 @@ $(document).on('click', 'section.sa-wrapper input#save', ( ->
|
||||
|
||||
alert("save")
|
||||
));
|
||||
|
||||
show: =>
|
||||
alert("show")
|
||||
#$.postWithPrefix "/sa_show", (response) =>
|
||||
# answers = response.answers
|
||||
# @el.addClass 'showed'
|
||||
|
||||
save: =>
|
||||
alert("save")
|
||||
|
||||
|
||||
@@ -74,6 +74,30 @@ class SelfAssessmentModule(XModule):
|
||||
|
||||
self.answers={}
|
||||
|
||||
self.score=0
|
||||
|
||||
self.max_score=1
|
||||
|
||||
def get_score(self):
|
||||
return self.score
|
||||
|
||||
def max_score(self):
|
||||
return self.max_score
|
||||
|
||||
def get_progress(self):
|
||||
''' For now, just return score / max_score
|
||||
'''
|
||||
score = self.get_score()
|
||||
score = d['score']
|
||||
total = self.max_score()
|
||||
if total > 0:
|
||||
try:
|
||||
return Progress(score, total)
|
||||
except Exception as err:
|
||||
log.exception("Got bad progress")
|
||||
return None
|
||||
return None
|
||||
|
||||
|
||||
def handle_ajax(self, dispatch, get):
|
||||
'''
|
||||
@@ -105,8 +129,8 @@ class SelfAssessmentModule(XModule):
|
||||
|
||||
|
||||
|
||||
def show_rubric:
|
||||
return {'success': True}
|
||||
def show_rubric(self,get):
|
||||
return {'success': True, 'rubric':rubric_form}
|
||||
|
||||
|
||||
def save_problem(self, get):
|
||||
|
||||
Reference in New Issue
Block a user