Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Towards #53

  • Loading branch information...
commit 2babbcc031b5b3fa68d126d349bd6addf27cc800 1 parent d32e2e6
@nomadali authored
View
9 .gitignore
@@ -20,4 +20,11 @@
.idea/vcs.xml
-.idea/workspace.xml
+.idea/workspace.xml
+src/lib/pygments/console.pyc
+
+src/lib/pygments/lexers/__init__.pyc
+
+src/lib/pygments/lexer.pyc
+
+src/lib/pygments/formatters/*.pyc
View
18 src/jeeqs.py
@@ -104,9 +104,6 @@ def prettify_injeeqs(injeeqs):
elif jeeq.vote == 'incorrect':
jeeq.icon = 'ui-icon-closethick'
jeeq.background = '#FFE3E3'
- elif jeeq.vote == 'genius':
- jeeq.icon = 'ui-icon-lightbulb'
- jeeq.background = '#FFFFE6'
elif jeeq.vote == 'flag':
jeeq.icon = 'ui-icon-flag'
jeeq.background = 'lightgrey'
@@ -137,7 +134,7 @@ def get(self):
if active_submissions.get(ch.key()):
jc = active_submissions[ch.key()]
ch.submitted = True
- ch.solved = True if (jc.correct_count + jc.genius_count > jc.incorrect_count + jc.flag_count) else False
+ ch.status = jc.status
ch.jc = jc
else:
@@ -436,8 +433,6 @@ def get_vote_numeric_value(vote):
return 2
elif vote == 'incorrect':
return 0
- elif vote == 'genius':
- return 4
else:
return 0 # flag
@@ -452,9 +447,6 @@ def update_submission(submission, jeeqser_challenge, vote, voter):
elif vote == 'incorrect':
submission.incorrect_count += 1
jeeqser_challenge.incorrect_count = submission.incorrect_count
- elif vote == 'genius':
- submission.genius_count += 1
- jeeqser_challenge.genius_count = submission.genius_count
elif vote == 'flag':
submission.flag_count += 1
jeeqser_challenge.flag_count = submission.flag_count
@@ -463,6 +455,12 @@ def update_submission(submission, jeeqser_challenge, vote, voter):
spam_manager.flag_author(submission.author)
submission.flagged_by.append(voter.key())
+ #update status on submission and jeeqser_challenge
+ if submission.correct_count > submission.incorrect_count + submission.flag_count:
+ submission.status = jeeqser_challenge.status = 'correct'
+ else:
+ submission.status = jeeqser_challenge.status = 'incorrect'
+
def get_in_jeeqs(self):
submission_key = self.request.get('submission_key')
@@ -623,7 +621,7 @@ def persist_new_submission():
attempt.put()
jeeqser_challenge.active_attempt = attempt
- jeeqser_challenge.correct_count = jeeqser_challenge.incorrect_count = jeeqser_challenge.genius_count = jeeqser_challenge.flag_count = 0
+ jeeqser_challenge.correct_count = jeeqser_challenge.incorrect_count = jeeqser_challenge.flag_count = 0
jeeqser_challenge.put()
jeeqser = Jeeqser.get(ns.jeeqser.key())
View
8 src/models.py
@@ -220,8 +220,10 @@ class Attempt(db.Model):
correct_count = db.IntegerProperty(default=0)
incorrect_count = db.IntegerProperty(default=0)
- genius_count = db.IntegerProperty(default=0)
flag_count = db.IntegerProperty(default=0)
+ # Status of jeeqser's submission for this challenge
+ # a challenge is solved if correct_count > incorrect_count + flag_count
+ status = db.StringProperty(choices=['correct', 'incorrect'])
#vote quantization TODO: might be removed !?
vote_sum = db.FloatProperty(default=float(0))
@@ -250,8 +252,10 @@ class Jeeqser_Challenge(db.Model):
# vote counts for the active attempt (denormalized from the active attempt)
correct_count = db.IntegerProperty(default=0)
incorrect_count = db.IntegerProperty(default=0)
- genius_count = db.IntegerProperty(default=0)
flag_count = db.IntegerProperty(default=0)
+ # Status of jeeqser's submission for this challenge
+ # a challenge is solved if correct_count > incorrect_count + flag_count
+ status = db.StringProperty(choices=['correct', 'incorrect'])
#TODO: move feedback to the same entity group as a submission
View
1  src/static/jeeqs.css
@@ -96,7 +96,6 @@ a img {
}
.submission-feedback { padding: 10px !important; }
-div.submission-feedback .ui-state-active.genius_label {background: yellow;}
div.submission-feedback .ui-state-active.correct_label {background:green}
div.submission-feedback .ui-state-active.incorrect_label {background: #ff5967}
div.submission-feedback .ui-state-active.flag_label {background: grey;}
View
1  src/templates/attempt_score.html
@@ -1,6 +1,5 @@
<span>
<span style="color:green; float:left;">{{ submission.correct_count }}&nbsp;</span>
<span style="color:red; float:left">{{ submission.incorrect_count }}&nbsp;</span>
- <span style="color:gold; float:left">{{ submission.genius_count }}&nbsp;</span>
<span style="color:grey; float:left">{{ submission.flag_count }}&nbsp;</span>
</span>
View
12 src/templates/home.html
@@ -41,14 +41,18 @@
<span>
<span class="ui-icon ui-icon-check" style="float:left"></span>
<span class="ui-icon ui-icon-closethick" style="float:left"></span>
- <span class="ui-icon ui-icon-lightbulb" style="float:left"></span>
<span class="ui-icon ui-icon-flag" style="float:left"></span>
</span>
</td>
<td></td>
</tr>
{% for challenge in challenges %}
- <tr {% if challenge.solved %} style="background: #90ee90"{% endif %}>
+ <tr {% if challenge.status == 'correct' %}
+ style="background: #90ee90"
+ {% endif %}
+ {% if challenge.status == 'incorrect' %}
+ style="background: #f08080"
+ {% endif %}>
<td>
<a class="noline" href="/challenge/?ch={{ challenge.key }}">
{{ challenge.name }} {% if challenge.automatic_review %} <span title="Jeeqs will reviews this!" class="ui-icon ui-icon-transferthick-e-w" style="float:right"></span>{% endif %}
@@ -57,7 +61,7 @@
<td>
<span>
<a class="noline" href="/challenge/?ch={{ challenge.key }}" title="Solve this challenge">
- {% if challenge.solved %}
+ {% if challenge.status == 'correct' %}
<span class="ui-icon ui-icon-unlocked" style="float:left"></span>
{% else %}
<span class="ui-icon ui-icon-key" style="float:left"></span>
@@ -71,7 +75,7 @@
{% endif %}
</td>
<td>
- {% if jeeqser and challenge.solved or isadmin %}
+ {% if jeeqser and challenge.status == 'correct' or isadmin %}
<a class="noline" href="/review/?ch={{ challenge.key }}" title="Review this challenge"><span class="ui-icon ui-icon-pencil" style="float:left"></span></a>
{% endif %}
</td>
View
4 src/templates/review_a_challenge.html
@@ -119,10 +119,6 @@
value="correct"/>
<label for="correct_{{ submission.key }}" class="correct_label" title="Correct"><span class="ui-icon ui-icon-check"></span></label>
- <input type="radio" id="genius_{{ submission.key }}" name="feedback_{{ submission.key }}"
- value="genius" class="genius_checkbox"/>
- <label for="genius_{{ submission.key }}" title="Genius!" class="genius_label"><span class="ui-icon ui-icon-lightbulb"></span></label>
-
<input type="radio" id="flag_{{ submission.key }}" name="feedback_{{ submission.key }}"
value="flag" class="flag_checkbox"/>
<label for="flag_{{ submission.key }}" title="Spam!" class="flag_label"><span class="ui-icon ui-icon-flag"></span></label>
View
30 src/templates/solve_a_challenge.html
@@ -199,20 +199,6 @@
{% endif %}
</div>
- <div id="recent-attempts" class="accordion accordion-closed" style="width:100%; float:right; clear:right; padding:15px; margin: 10px;">
- <h3><a href="#">Your Recent Submissions</a></h3>
- <div class="recent-jeeqs">
- {% if jeeqser %}
- {% for attempt in attempts %}
- <p> <a class="noline" href="/challenge/?ch={{ challenge.key }}&att={{ attempt.key }}"> Attempt #{{ attempt.index }}</a> at: {{ attempt.date }}</p>
- <div>
- {{ attempt.content|safe }}
- </div>
- <hr/>
- {% endfor %}
- {% endif %}
- </div>
- </div>
{% endblock column2 %}
{% block footer %}
@@ -238,4 +224,20 @@
{% endif %}
</div>
</div>
+
+ <div id="recent-attempts" class="accordion accordion-closed" style="width:100%; clear:both; margin-top: 20px">
+ <h3><a href="#">Your Recent Submissions</a></h3>
+ <div class="recent-jeeqs">
+ {% if jeeqser %}
+ {% for attempt in attempts %}
+ <p> <a class="noline" href="/challenge/?ch={{ challenge.key }}&att={{ attempt.key }}"> Attempt #{{ attempt.index }}</a> at: {{ attempt.date }}</p>
+ <div>
+ {{ attempt.content|safe }}
+ </div>
+ <hr/>
+ {% endfor %}
+ {% endif %}
+ </div>
+ </div>
+
{% endblock footer %}
Please sign in to comment.
Something went wrong with that request. Please try again.