Commit 0739d3ba by Vik Paruchuri

adding in progress functionality

parent 56637347
$(document).on('click', 'section.sa-wrapper input#show', ( -> $(document).on('click', 'section.sa-wrapper input#show', ( ->
root = location.protocol + "//" + location.host root = location.protocol + "//" + location.host
post_url=$('section.sa-wrapper input#show').attr('url') 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" 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) -> $.post final_url, answer, (response) ->
if response.success alert("posted")
$('p.rubric').replace(response.rubric) if response.success
alert(response.rubric)
$('section.sa-wrapper p#rubric').replace(response.rubric)
alert("save") alert("save")
)); ));
...@@ -33,13 +34,3 @@ $(document).on('click', 'section.sa-wrapper input#save', ( -> ...@@ -33,13 +34,3 @@ $(document).on('click', 'section.sa-wrapper input#save', ( ->
alert("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): ...@@ -74,6 +74,30 @@ class SelfAssessmentModule(XModule):
self.answers={} 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): def handle_ajax(self, dispatch, get):
''' '''
...@@ -105,8 +129,8 @@ class SelfAssessmentModule(XModule): ...@@ -105,8 +129,8 @@ class SelfAssessmentModule(XModule):
def show_rubric: def show_rubric(self,get):
return {'success': True} return {'success': True, 'rubric':rubric_form}
def save_problem(self, get): def save_problem(self, get):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment