answer=answer.lower()# for analyzing the student input string I make it lower case.
answer=answer.lower()# for analyzing the student input string I make it lower case.
found_equal_sign=0
found_equal_sign=0
...
@@ -193,10 +175,8 @@ class CrowdsourceHinter(XBlock):
...
@@ -193,10 +175,8 @@ class CrowdsourceHinter(XBlock):
"""
"""
This function is used to check that an incorrect answer has available hints to show.
This function is used to check that an incorrect answer has available hints to show.
It will also add the incorrect answer test to self.incorrect_answers.
It will also add the incorrect answer test to self.incorrect_answers.
Args:
Args:
answer: This is equal to answer from get_hint, the answer the student submitted
answer: This is equal to answer from get_hint, the answer the student submitted
Returns 0 if no hints to show exist
Returns 0 if no hints to show exist
"""
"""
isreported=[]
isreported=[]
...
@@ -221,7 +201,6 @@ class CrowdsourceHinter(XBlock):
...
@@ -221,7 +201,6 @@ class CrowdsourceHinter(XBlock):
Specifically this function is used to send necessary data to JS about incorrect answer
Specifically this function is used to send necessary data to JS about incorrect answer
submissions and hints. It also will return hints that have been reported, although this
submissions and hints. It also will return hints that have been reported, although this
is only for Staff.
is only for Staff.
Returns:
Returns:
used_hint_answer_text: This dicitonary contains reported hints/answers (if the user is staff) and the
used_hint_answer_text: This dicitonary contains reported hints/answers (if the user is staff) and the
first hint/answer pair that the student submitted for a problem.
first hint/answer pair that the student submitted for a problem.
...
@@ -232,8 +211,6 @@ class CrowdsourceHinter(XBlock):
...
@@ -232,8 +211,6 @@ class CrowdsourceHinter(XBlock):
# corresponding incorrect answer
# corresponding incorrect answer
used_hint_answer_text={}
used_hint_answer_text={}
ifself.get_user_is_staff():
ifself.get_user_is_staff():
printlen(self.reported_hints)
printstr(self.reported_hints)
forkeyinself.reported_hints:
forkeyinself.reported_hints:
used_hint_answer_text[key]=str("Reported")
used_hint_answer_text[key]=str("Reported")
iflen(self.incorrect_answers)==0:
iflen(self.incorrect_answers)==0:
...
@@ -261,14 +238,11 @@ class CrowdsourceHinter(XBlock):
...
@@ -261,14 +238,11 @@ class CrowdsourceHinter(XBlock):
defrate_hint(self,data,suffix=''):
defrate_hint(self,data,suffix=''):
"""
"""
Used to facilitate hint rating by students.
Used to facilitate hint rating by students.
Hint ratings in hint_database are updated and the resulting hint rating (or reported status) is returned to JS.
Hint ratings in hint_database are updated and the resulting hint rating (or reported status) is returned to JS.
Args:
Args:
data['student_answer']: The incorrect answer that corresponds to the hint that is being rated
data['student_answer']: The incorrect answer that corresponds to the hint that is being rated
data['hint']: The hint that is being rated
data['hint']: The hint that is being rated
data['student_rating']: The rating chosen by the student.
data['student_rating']: The rating chosen by the student.
Returns:
Returns:
'rating': the new rating of the hint, or the string 'reported' if the hint was reported
'rating': the new rating of the hint, or the string 'reported' if the hint was reported
'hint': the hint that had its rating changed
'hint': the hint that had its rating changed
...
@@ -301,12 +275,10 @@ class CrowdsourceHinter(XBlock):
...
@@ -301,12 +275,10 @@ class CrowdsourceHinter(XBlock):
This function is used to change the rating of a hint when students vote on its helpfulness.
This function is used to change the rating of a hint when students vote on its helpfulness.
Initiated by rate_hint. The temporary_dictionary is manipulated to be used
Initiated by rate_hint. The temporary_dictionary is manipulated to be used
in self.rate_hint
in self.rate_hint
Args:
Args:
data_hint: This is equal to the data['hint'] in self.rate_hint
data_hint: This is equal to the data['hint'] in self.rate_hint
data_rating: This is equal to the data['student_rating'] in self.rate_hint
data_rating: This is equal to the data['student_rating'] in self.rate_hint
answer_data: This is equal to the data['student_answer'] in self.rate_hint
answer_data: This is equal to the data['student_answer'] in self.rate_hint
Returns:
Returns:
The rating associated with the hint is returned. This rating is identical
The rating associated with the hint is returned. This rating is identical
to what would be found under self.hint_database[answer_string[hint_string]]
to what would be found under self.hint_database[answer_string[hint_string]]
...
@@ -324,7 +296,6 @@ class CrowdsourceHinter(XBlock):
...
@@ -324,7 +296,6 @@ class CrowdsourceHinter(XBlock):
defadd_new_hint(self,data,suffix=''):
defadd_new_hint(self,data,suffix=''):
"""
"""
This function adds a new hint submitted by the student into the hint_database.
This function adds a new hint submitted by the student into the hint_database.
Args:
Args:
data['submission']: This is the text of the new hint that the student has submitted.
data['submission']: This is the text of the new hint that the student has submitted.
data['answer']: This is the incorrect answer for which the student is submitting a new hint.
data['answer']: This is the incorrect answer for which the student is submitting a new hint.
...
@@ -358,7 +329,7 @@ class CrowdsourceHinter(XBlock):
...
@@ -358,7 +329,7 @@ class CrowdsourceHinter(XBlock):
"""
"""
<verticaldemo>
<verticaldemo>
<crowdsourcehinter>
<crowdsourcehinter>
{"generic_hints": "Make sure to check for basic mistakes like typos", "initial_hints": {"michiganp": {"remove the p at the end", 0}, "michigann": {"too many Ns on there": 0}}, "hinting_element": "i4x://edX/DemoX/problem/Text_Input"}
{"generic_hints": "Make sure to check for basic mistakes like typos", "initial_hints": {"michiganp": "remove the p at the end."}, "michigann": "too many Ns on there."}, "hinting_element": "i4x://edX/DemoX/problem/Text_Input"}
</crowdsourcehinter>
</crowdsourcehinter>
</verticaldemo>
</verticaldemo>
"""
"""
...
@@ -372,7 +343,8 @@ class CrowdsourceHinter(XBlock):
...
@@ -372,7 +343,8 @@ class CrowdsourceHinter(XBlock):