Commit 26d6b8fb by Sola

fixed to upvote when duplicate hint is provided

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