Commit 663bad93 by solashirai

commiting prior to more UX changes

parent 116c79c1
...@@ -132,14 +132,16 @@ class CrowdsourceHinter(XBlock): ...@@ -132,14 +132,16 @@ class CrowdsourceHinter(XBlock):
if remaining_hints != str(0): if remaining_hints != str(0):
best_hint = max(self.hint_database[str(answer)].iteritems(), key=operator.itemgetter(1))[0] best_hint = max(self.hint_database[str(answer)].iteritems(), key=operator.itemgetter(1))[0]
if self.show_best['showbest'] == 'True': if self.show_best['showbest'] == 'True':
# if set to show best, only the best hint will be shown. Different hitns will not be shown
# for multiple submissions/hint requests
if best_hint not in self.Flagged.keys(): if best_hint not in self.Flagged.keys():
self.Used.append(best_hint) self.Used.append(best_hint)
return {'HintsToUse': best_hint} return {'HintsToUse': best_hint, "StudentAnswer": answer}
if best_hint not in self.Used: if best_hint not in self.Used:
# choose highest rated hint for the incorrect answer # choose highest rated hint for the incorrect answer
if best_hint not in self.Flagged.keys(): if best_hint not in self.Flagged.keys():
self.Used.append(best_hint) self.Used.append(best_hint)
return {'HintsToUse': best_hint} return {'HintsToUse': best_hint, "StudentAnswer": answer}
else: else:
# choose another random hint for the answer. # choose another random hint for the answer.
temporary_hints_list = [] temporary_hints_list = []
...@@ -153,7 +155,7 @@ class CrowdsourceHinter(XBlock): ...@@ -153,7 +155,7 @@ class CrowdsourceHinter(XBlock):
# choose highest rated hint for the incorrect answer # choose highest rated hint for the incorrect answer
if best_hint not in self.Flagged.keys(): if best_hint not in self.Flagged.keys():
self.Used.append(best_hint) self.Used.append(best_hint)
return {'HintsToUse': best_hint} return {'HintsToUse': best_hint, "StudentAnswer": answer}
else: else:
temporary_hints_list = [] temporary_hints_list = []
for hint_keys in self.DefaultHints: for hint_keys in self.DefaultHints:
...@@ -164,7 +166,7 @@ class CrowdsourceHinter(XBlock): ...@@ -164,7 +166,7 @@ class CrowdsourceHinter(XBlock):
else: else:
# if there are no more hints left in either the database or defaults # if there are no more hints left in either the database or defaults
self.Used.append(str("There are no hints for" + " " + answer)) self.Used.append(str("There are no hints for" + " " + answer))
return {'HintsToUse': "Sorry, there are no more hints for this answer."} return {'HintsToUse': "Sorry, there are no more hints for this answer.", "StudentAnswer": answer}
self.Used.append(not_used) self.Used.append(not_used)
return {'HintsToUse': not_used, "StudentAnswer": answer} return {'HintsToUse': not_used, "StudentAnswer": answer}
...@@ -287,7 +289,8 @@ class CrowdsourceHinter(XBlock): ...@@ -287,7 +289,8 @@ class CrowdsourceHinter(XBlock):
hint_rating['rating'] = temporary_dictionary[data['hint']] hint_rating['rating'] = temporary_dictionary[data['hint']]
hint_rating['student_answer'] = data['student_answer'] hint_rating['student_answer'] = data['student_answer']
hint_rating['hint'] = data['hint'] hint_rating['hint'] = data['hint']
return hint_rating print(hint_rating)
return hint_rating
@XBlock.json_handler @XBlock.json_handler
def rate_hint(self, data, suffix=''): def rate_hint(self, data, suffix=''):
......
...@@ -27,7 +27,13 @@ ...@@ -27,7 +27,13 @@
.csh_hint_reveal{ .csh_hint_reveal{
display: flex; display: flex;
flex-direction: column;
}
.csh_HintQuickFeedback{
display: flex;
flex-direction: row; flex-direction: row;
justify-content: flex-end;
} }
.csh_hint_data{ .csh_hint_data{
...@@ -38,19 +44,16 @@ ...@@ -38,19 +44,16 @@
} }
.csh_rate_hint { .csh_rate_hint {
width: 100%; margin-right: 15px;
margin-left:auto;
margin-right:auto;
} }
div[data-rate="flag"]{ div[data-rate="flag"]{
align-self: flex-end; font-weight: bold;
} }
div[data-rate="upvote"] { div[data-rate="upvote"] {
color: green; color: green;
font-weight: bold; font-weight: bold;
margin-right:15px;
} }
div[data-rate="downvote"] { div[data-rate="downvote"] {
......
...@@ -54,10 +54,9 @@ ...@@ -54,10 +54,9 @@
<div class="crowdsourcehinter_block"> <div class="crowdsourcehinter_block">
<div class='csh_hint_reveal'> <div class='csh_hint_reveal'>
<div> <div class='csh_HintsToUse' student_answer = ''>
<span class='csh_HintsToUse' student_answer = ''></span>
</div> </div>
<div> <div class='csh_HintQuickFeedback'>
<div role="button" class="csh_rate_hint" data-rate="upvote" data-icon="arrow-u" aria-label="upvote"> <div role="button" class="csh_rate_hint" data-rate="upvote" data-icon="arrow-u" aria-label="upvote">
<b></b> <b></b>
</div> </div>
......
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