Add in correctness display
This commit is contained in:
@@ -218,11 +218,19 @@ class CombinedOpenEndedModule(XModule):
|
||||
last_post_assessment = task.latest_post_assessment(short_feedback=False)
|
||||
last_post_evaluation = task.format_feedback_with_evaluation(last_post_assessment)
|
||||
last_post_assessment = last_post_evaluation
|
||||
last_correctness = task.is_last_response_correct()
|
||||
max_score = task.max_score()
|
||||
state = task.state
|
||||
last_response_dict={'response' : last_response, 'score' : last_score,
|
||||
'post_assessment' : last_post_assessment,
|
||||
'type' : task_type, 'max_score' : max_score, 'state' : state, 'human_state' : task.HUMAN_NAMES[state]}
|
||||
last_response_dict={
|
||||
'response' : last_response,
|
||||
'score' : last_score,
|
||||
'post_assessment' : last_post_assessment,
|
||||
'type' : task_type,
|
||||
'max_score' : max_score,
|
||||
'state' : state,
|
||||
'human_state' : task.HUMAN_NAMES[state],
|
||||
'correct' : last_correctness
|
||||
}
|
||||
|
||||
return last_response_dict
|
||||
|
||||
@@ -252,7 +260,7 @@ class CombinedOpenEndedModule(XModule):
|
||||
task_number=int(get['task_number'])
|
||||
self.update_task_states()
|
||||
response_dict=self.get_last_response(task_number)
|
||||
context = {'results' : response_dict['post_assessment']}
|
||||
context = {'results' : response_dict['post_assessment'], 'task_number' : task_number+1}
|
||||
html = render_to_string('combined_open_ended_results.html', context)
|
||||
return {'html' : html, 'success' : True}
|
||||
|
||||
|
||||
@@ -397,13 +397,6 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
|
||||
short_feedback = self._convert_longform_feedback_to_html(json.loads(self.history[-1].get('post_assessment', "")))
|
||||
return short_feedback if feedback_dict['valid'] else ''
|
||||
|
||||
def is_submission_correct(self, score):
|
||||
correct=False
|
||||
if(isinstance(score,(int, long, float, complex))):
|
||||
score_ratio = int(score) / float(self.max_score())
|
||||
correct = (score_ratio >= 0.66)
|
||||
return correct
|
||||
|
||||
def format_feedback_with_evaluation(self,feedback):
|
||||
context={'msg' : feedback, 'id' : "1", 'rows' : 50, 'cols' : 50}
|
||||
html= render_to_string('open_ended_evaluation.html', context)
|
||||
|
||||
@@ -250,5 +250,16 @@ class OpenEndedChild():
|
||||
def handle_ajax(self):
|
||||
pass
|
||||
|
||||
def is_submission_correct(self, score):
|
||||
correct=False
|
||||
if(isinstance(score,(int, long, float, complex))):
|
||||
score_ratio = int(score) / float(self.max_score())
|
||||
correct = (score_ratio >= 0.66)
|
||||
return correct
|
||||
|
||||
def is_last_response_correct(self):
|
||||
score=self.get_score()
|
||||
return self.is_submission_correct(score)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
</div>
|
||||
|
||||
<div class="result-container">
|
||||
<h4>Results</h4><br/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="result-container">
|
||||
<h4>Results</h4><br/>
|
||||
<h4>Results from Step ${task_number}</h4><br/>
|
||||
${results | n}
|
||||
</div>
|
||||
@@ -8,7 +8,7 @@
|
||||
%endif
|
||||
|
||||
Step ${status['task_number']} (${status['human_state']}) : ${status['score']} / ${status['max_score']}
|
||||
%if status['type']=="openended":
|
||||
%if status['type']=="openended" and status['state'] in ['done', 'post_assessment']:
|
||||
<div class="show-results">
|
||||
<a href="#" class="show-results-button">Show results from step ${status['task_number']}</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user