Commit bad98791 by Sola

attempt to force into branch, blanket commit

parent 24790dbc
<<<<<<< HEAD
This is the Crowd Sourced Hinter XBlock. The Crowd Sourced Hinter provides students
with hints when they incorrectly answer a numerical-or text-input problem. Additionally,
the hints that are provided to students are student-made hints.
This XBlock is still under construction. Functionalities to set default hints, properly moderate flagged hints, and lots of improvements to user interface are to be done soon.
backlog: https://docs.google.com/a/edx.org/document/d/1lOBLZWohwRmnfgwz53gc4b4GdfP4EER3UNohdYfcEJU/edit#
An example of a student recieving a hint
![CrowdSourcedHinter Hint Screenshot](crowdsourcedhinter_hint.png)
An example of a hint giving feedback
![CrowdSourcedHinter Student Feedback Screenshot](crowdsourcedhinter_feedback.png)
To bring the crowd sourced hinter into a demo course:
First, follow https://github.com/edx/edx-platform/blob/master/docs/en_us/developers/source/xblocks.rst#testing for general xblock creation.
The name of the module will be "crowdxblock" in advanced settings.
After creating a new unit, add the crowdsourcedhinter xblock just like any other custom xblock. The name of the crowd sourced hinter may not show up for some reason, but an empty space where its name should be will be clickable.
Testing the crowd sourced hinter's hint providng/storing works best when switching between different users and answering the same problem within a unit. Going back and forth between different problems within the same subsection might possibly cause problems.
After a student incorrectly answers a problem, a hint will be provided. This hint will either be a default hint or a hint that has been submitted specifically for that incorrect answer (if such a hint has previously been submitted). If multiple hints exist for a single incorrect answer, the current system will choose the highest rated hint to show the student.
After a student has correctly answered the problem, they can give feedback on hints. Students can upvote, downvote, or flag the hint that they recieved for each aswer as well as 2 other hints that exist for that aswer (if these exist). Students also can submit new hints for their answer.
=======
CHANGEchange
Newchange
>>>>>>> 9bf9384eb97feec5f771c984ee0510f675812ccc
<<<<<<< HEAD
This is the Crowd Sourced Hinter XBlock. The Crowd Sourced Hinter provides students
with hints when they incorrectly answer a numerical-or text-input problem. Additionally,
the hints that are provided to students are student-made hints.
This XBlock is still under construction. Functionalities to set default hints, properly moderate flagged hints, and lots of improvements to user interface are to be done soon.
backlog: https://docs.google.com/a/edx.org/document/d/1lOBLZWohwRmnfgwz53gc4b4GdfP4EER3UNohdYfcEJU/edit#
An example of a student recieving a hint
![CrowdSourcedHinter Hint Screenshot](crowdsourcedhinter_hint.png)
An example of a hint giving feedback
![CrowdSourcedHinter Student Feedback Screenshot](crowdsourcedhinter_feedback.png)
To bring the crowd sourced hinter into a demo course:
First, follow https://github.com/edx/edx-platform/blob/master/docs/en_us/developers/source/xblocks.rst#testing for general xblock creation.
The name of the module will be "crowdxblock" in advanced settings.
After creating a new unit, add the crowdsourcedhinter xblock just like any other custom xblock. The name of the crowd sourced hinter may not show up for some reason, but an empty space where its name should be will be clickable.
Testing the functionality of the crowd sourced hinter works best when switching between different users and answering the same problem within a unit.
After a student incorrectly answers a problem, a hint will be provided. This hint will either be a default hint or a hint that has been submitted specifically for that incorrect answer (if such a hint has previously been submitted). If multiple hints exist for a single incorrect answer, the current system will choose the highest rated hint to show the student.
After a student has correctly answered the problem, they can give feedback on hints. Students can upvote, downvote, or flag the hint that they recieved for each aswer as well as 2 other hints that exist for that aswer (if these exist). Students also can submit new hints for their answer.
=======
CHANGEchange
>>>>>>> 9bf9384eb97feec5f771c984ee0510f675812ccc
...@@ -426,9 +426,3 @@ class CrowdXBlock(XBlock): ...@@ -426,9 +426,3 @@ class CrowdXBlock(XBlock):
</vertical_demo> </vertical_demo>
"""), """),
] ]
'''
print ("answer" + str(data["submittedanswer"]))
for keys in self.hints[key]:
print ("other key" + y)
self.HintsToUse[keys] = self.hints[key[keys]] #If the user's incorrect answre has precedence in hints, add hints listed under
print("hintstouse: " + str(self.HintsToUse[keys]))'''
...@@ -211,17 +211,23 @@ class CrowdXBlock(XBlock): ...@@ -211,17 +211,23 @@ class CrowdXBlock(XBlock):
# each index is a hint that was used, in order of usage # each index is a hint that was used, in order of usage
for answer_keys in self.hint_database: for answer_keys in self.hint_database:
if str(self.Used[index]) in self.hint_database[str(answer_keys)]: if str(self.Used[index]) in self.hint_database[str(answer_keys)]:
# add new key (hint) to feedback_data with a value (incorrect answer)
feedback_data[str(self.Used[index])] = str(self.WrongAnswers[index]) feedback_data[str(self.Used[index])] = str(self.WrongAnswers[index])
for answer_keys in self.hint_database: for answer_keys in self.hint_database:
if str(answer_keys) == str(self.WrongAnswers[index]): if str(answer_keys) == str(self.WrongAnswers[index]):
# for answes in self.hint_database, if the len of the answer's corresponding
# hints is not zero...
if str(len(self.hint_database[str(answer_keys)])) != str(0): if str(len(self.hint_database[str(answer_keys)])) != str(0):
number_of_hints = 0 number_of_hints = 0
hint_key_shuffled = self.hint_database[str(answer_keys)].keys() hint_key_shuffled = self.hint_database[str(answer_keys)].keys()
# shuffle keys so that random hints won't repeat. probably can be done better.
random.shuffle(hint_key_shuffled) random.shuffle(hint_key_shuffled)
for random_hint_key in hint_key_shuffled: for random_hint_key in hint_key_shuffled:
if str(random_hint_key) not in self.Flagged.keys(): if str(random_hint_key) not in self.Flagged.keys():
if number_of_hints < 3: if number_of_hints < 3:
number_of_hints += 1 number_of_hints += 1
# add random unused hint to feedback_data's keys
# with the value as the incorrect answer
feedback_data[str(random_hint_key)] = str(self.WrongAnswers[index]) feedback_data[str(random_hint_key)] = str(self.WrongAnswers[index])
self.WrongAnswers.append(str(self.WrongAnswers[index])) self.WrongAnswers.append(str(self.WrongAnswers[index]))
self.Used.append(str(random_hint_key)) self.Used.append(str(random_hint_key))
...@@ -257,19 +263,22 @@ class CrowdXBlock(XBlock): ...@@ -257,19 +263,22 @@ class CrowdXBlock(XBlock):
If the hint has already been voted on, 'You have already voted on this hint!' If the hint has already been voted on, 'You have already voted on this hint!'
will be returned to JS. will be returned to JS.
""" """
original_data = data['answer'] original_data = data['answer'] # original strings are saved to return later
answer_data = data['answer'] answer_data = data['answer']
# answer_data is manipulated to remove symbols to prevent errors that
# might arise due to certain symbols. I don't think I have this fully working but am not sure.
data_rating = data['student_rating'] data_rating = data['student_rating']
data_value = data['value'] data_value = data['value']
answer_data = self.remove_symbols(answer_data) answer_data = self.remove_symbols(answer_data)
if str(data['student_rating']) == str(0): if str(data['student_rating']) == str(0):
# if student flagged hint
self.hint_flagged(data['value'], answer_data) self.hint_flagged(data['value'], answer_data)
return {"rating": 'thiswasflagged', 'origdata': original_data} return {"rating": 'thiswasflagged', 'origdata': original_data}
if str(answer_data) not in self.Voted: if str(answer_data) not in self.Voted:
self.Voted.append(str(answer_data)) self.Voted.append(str(answer_data)) # add data to Voted to prevent multiple votes
rating = self.change_rating(data_value, int(data_rating), answer_data) rating = self.change_rating(data_value, int(data_rating), answer_data) # change hint rating
print str(self.change_rating(data['value'], int(data['student_rating']), answer_data))
if str(rating) == str(0): if str(rating) == str(0):
# if the rating is "0", return "zzeerroo" instead. "0" showed up as "null" in JS
return {"rating": str('zzeerroo'), 'origdata': original_data} return {"rating": str('zzeerroo'), 'origdata': original_data}
else: else:
return {"rating": str(rating), 'origdata': original_data} return {"rating": str(rating), 'origdata': original_data}
...@@ -308,10 +317,15 @@ class CrowdXBlock(XBlock): ...@@ -308,10 +317,15 @@ class CrowdXBlock(XBlock):
""" """
for hint_keys in self.Used: for hint_keys in self.Used:
if str(hint_keys) == str(answer_data): if str(hint_keys) == str(answer_data):
# use index of hint used to find the hint within self.hint_database
answer = self.Used.index(str(answer_data)) answer = self.Used.index(str(answer_data))
for answer_keys in self.hint_database: for answer_keys in self.hint_database:
temporary_dictionary = str(self.hint_database[str(answer_keys)]) temporary_dictionary = str(self.hint_database[str(answer_keys)])
temporary_dictionary = (ast.literal_eval(temporary_dictionary)) temporary_dictionary = (ast.literal_eval(temporary_dictionary))
# if I remember correctly, changing the rating values in self.hint_database
# didn't work correctly for some reason, so instead I manipulated this
# temporary dictionary and then set self.hint_database to equal it.
# probably due to scope error (which also is affecting the studio interactions)
if str(answer_keys) == str(self.WrongAnswers[answer]): if str(answer_keys) == str(self.WrongAnswers[answer]):
temporary_dictionary[self.Used[int(answer)]] += int(data_rating) temporary_dictionary[self.Used[int(answer)]] += int(data_rating)
self.hint_database[str(answer_keys)] = temporary_dictionary self.hint_database[str(answer_keys)] = temporary_dictionary
...@@ -339,7 +353,7 @@ class CrowdXBlock(XBlock): ...@@ -339,7 +353,7 @@ class CrowdXBlock(XBlock):
@XBlock.json_handler @XBlock.json_handler
def moderate_hint(self, data, suffix=''): def moderate_hint(self, data, suffix=''):
""" """
under construction, intended to be used for instructors to remove hints from the database after hints UNDER CONSTRUCTION, intended to be used for instructors to remove hints from the database after hints
have been flagged. have been flagged.
""" """
flagged_hints = {} flagged_hints = {}
...@@ -370,13 +384,18 @@ class CrowdXBlock(XBlock): ...@@ -370,13 +384,18 @@ class CrowdXBlock(XBlock):
hint_id = data['answer'].replace('ddeecciimmaallppooiinntt', '.') hint_id = data['answer'].replace('ddeecciimmaallppooiinntt', '.')
for answer_keys in self.hint_database: for answer_keys in self.hint_database:
if str(answer_keys) == self.WrongAnswers[self.Used.index(hint_id)]: if str(answer_keys) == self.WrongAnswers[self.Used.index(hint_id)]:
# find the answer for which a hint is being submitted
if str(submission) not in self.hint_database[str(answer_keys)]: if str(submission) not in self.hint_database[str(answer_keys)]:
temporary_dictionary = str(self.hint_database[str(answer_keys)]) temporary_dictionary = str(self.hint_database[str(answer_keys)])
temporary_dictionary = (ast.literal_eval(temporary_dictionary)) temporary_dictionary = (ast.literal_eval(temporary_dictionary))
temporary_dictionary.update({submission: 0}) temporary_dictionary.update({submission: 0})
# once again, manipulating temporary_dictionary and setting
# self.hint_database equal to it due to being unable to directly
# edit self.hint_databse. Most likely scope error
self.hint_database[str(answer_keys)] = temporary_dictionary self.hint_database[str(answer_keys)] = temporary_dictionary
return return
else: else:
# if the hint exists already, simply upvote the previously entered hint
hint_index = self.Used.index(submission) hint_index = self.Used.index(submission)
for default_hints in self.DefaultHints: for default_hints in self.DefaultHints:
if default_hints == self.Used[int(hint_index)]: if default_hints == self.Used[int(hint_index)]:
......
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