Commit 26d6b8fb by Sola

fixed to upvote when duplicate hint is provided

parent 5f53a0f5
......@@ -112,8 +112,23 @@ class CrowdXBlock(XBlock):
print("hints are " + str(self.hints[str(key)]))
print("otherstuff " + str(self.hints))
else:
self.hints[str(key)[str(data['submission'])]] += 1
self.Voted = 1
ansnum = self.Used.index(data['submission'])
for key in self.DefaultHints:
if key == self.Used[int(ansnum)]: #rating for hints in DefaultHints
self.DefaultHints[str(key)] += int(1)
self.Voted = 1
print str(self.DefaultHints)
return
for key in self.hints:
tempdict = str(self.hints[str(key)]) #rate hint that is in hints
tempdict = (ast.literal_eval(tempdict))
if str(key) == str(self.WrongAnswers[int(ansnum)]): #ansnum will the the answer/hint pair that is selected
tempdict[self.Used[int(ansnum)]] += int(1)
self.hints[str(key)] = tempdict
print("TESTING AGAIN HI")
print("hints are " + str(self.hints[str(key)]))
print("otherstuff " + str(self.hints))
self.Voted = 1
@XBlock.json_handler
def clear_states(self, data, suffix=''):
......
......@@ -112,11 +112,26 @@ class CrowdXBlock(XBlock):
print("hints are " + str(self.hints[str(key)]))
print("otherstuff " + str(self.hints))
else:
self.hints[str(key)[str(data['submission'])]] += 1
self.Voted = 1
ansnum = self.Used.index[data['submission']]
for key in self.DefaultHints:
if key == self.Used[int(ansnum)]: #rating for hints in DefaultHints
self.DefaultHints[str(key)] += int(1)
self.Voted = 1
print str(self.DefaultHints)
return
for key in self.hints:
tempdict = str(self.hints[str(key)]) #rate hint that is in hints
tempdict = (ast.literal_eval(tempdict))
if str(key) == str(self.WrongAnswers[int(ansnum)]): #ansnum will the the answer/hint pair that is selected
tempdict[self.Used[int(ansnum)]] += int(1)
self.hints[str(key)] = tempdict
print("TESTING AGAIN HI")
print("hints are " + str(self.hints[str(key)]))
print("otherstuff " + str(self.hints))
self.Voted = 1
@XBlock.json_handler
def debugclearstates(self, data, suffix=''):
def clear_states(self, data, suffix=''):
self.Used = []
self.HintsToUse = {}
self.Voted = 0
......
......@@ -6,6 +6,7 @@
.crowdxblock_block button {
cursor: pointer;
background: rgb(0,0,200);
}
.crowdxblock_block .crowdsource-wrapper {
......@@ -14,7 +15,7 @@
display: none;
margin-top: 20px;
padding: (15px);
background: rgb(253, 248, 235);
background: rgb(50, 50, 235);
}
.crowdxblock_block .hint-inner-container {
......
......@@ -4,7 +4,7 @@
font-weight: bold;
}
.crowdxblock_block p {
.crowdxblock_block button {
cursor: pointer;
}
......@@ -14,7 +14,7 @@
display: none;
margin-top: 20px;
padding: (15px);
background: rgb(253, 248, 235);
background: rgb(50, 50, 235);
}
.crowdxblock_block .hint-inner-container {
......
<div class="crowdxblock_block"> <!--most stuff just for testing purposes-->
<p>CrowdXBlock: HINT! <span class='HintsToUse'>{self.HintsToUse}</span>
<div class="crowdxblock_block"> <!--most stuff just for testing purposes-->
<p>It's Hintin' Time! Here's your hint! <span class='HintsToUse'>{self.HintsToUse}</span>
</p>
<span><br><span> Dummy Answer Input Here</span></span>
<section id="studentinput" class="textinput">
......@@ -38,7 +38,6 @@
<span class='HintUsed3'></span>
</p> </div>
<p>
<input id="cu" type="button" value="clearUsed"><input id="cw" type="button" value="clearWrong"><input id="cv" type="button" value="clearVoted"><input id="ch" type="button" value="clearHintsToUse">
<input id="caus" type="button" value="clearAllUserState">
</p>
......
<div class="crowdxblock_block"> <!--most stuff just for testing purposes-->
<p>CrowdXBlock: HINT! <span class='HintsToUse'>{self.HintsToUse}</span>
<div class="crowdxblock_block" style="background-color:#00FFFF;"> <!--most stuff just for testing purposes-->
<p>It's Hintin' Time! Here's your hint! <span class='HintsToUse'>{self.HintsToUse}</span>
</p>
<span><br><span> Dummy Answer Input Here</span></span>
<section id="studentinput" class="textinput">
......@@ -37,6 +37,9 @@
<p>
<span class='HintUsed3'></span>
</p> </div>
<p>
<input id="caus" type="button" value="clearAllUserState">
</p>
<section class="solution-span"><span id="solution_i4x-Me-19_002-problem-Numerical_Input_solution_1"></span></section></div>
......@@ -50,10 +53,7 @@
<input type="text" name="studentinput" id="answer" class="math" size="40">
<input id="submit" type="button" value="Submit Hint">
</div></section></span><p>
<input id="cu" type="button" value="clearUsed"><input id="cw" type="button" value="clearWrong"><input id="cv" type="button" value="clearVoted"><input id="ch" type="button" value="clearHintsToUse">
<input id="caus" type="button" value="clearAllUserState">
</p>
</div></section></span>
</section>
</section>
......
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