Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moving Feedback to Attempt entity group

Moving Jeeqser_Challenge to Jeeqser's entity group
  • Loading branch information...
commit 3d171e81791b3461920640a21bc076c5f9e4dd4d 1 parent 2babbcc
@nomadali authored
View
11 src/jeeqs.py
@@ -606,6 +606,7 @@ def persist_new_submission():
else:
#create one
jeeqser_challenge = Jeeqser_Challenge(
+ parent=self.jeeqser,
jeeqser = self.jeeqser,
challenge = challenge
)
@@ -698,15 +699,16 @@ class Namespace(object): pass
if not self.jeeqser.key() in submission.users_voted:
jeeqser_challenge = Jeeqser_Challenge\
- .all()\
- .filter('jeeqser =', submission.author)\
- .filter('challenge = ', submission.challenge)\
- .fetch(1)
+ .all()\
+ .filter('jeeqser =', submission.author)\
+ .filter('challenge = ', submission.challenge)\
+ .fetch(1)
if len(jeeqser_challenge) == 0:
# should never happen but let's guard against it!
logging.error("Jeeqser_Challenge not available! for jeeqser : " + submission.author.user.email() + " and challenge : " + submission.challenge.name)
jeeqser_challenge = Jeeqser_Challenge(
+ parent = submission.author,
jeeqser = submission.author,
challenge = submission.challenge,
active_attempt = submission)
@@ -715,6 +717,7 @@ class Namespace(object): pass
jeeqser_challenge = jeeqser_challenge[0]
feedback = Feedback(
+ parent=submission,
attempt=submission,
author=self.jeeqser,
attempt_author=submission.author,
View
11 src/models.py
@@ -136,6 +136,10 @@ def set_name(self, value):
access_key = db.StringProperty()
vertical_scroll = db.FloatProperty()
+ #stats
+ num_jeeqsers_solved = db.IntegerProperty()
+ num_jeeqsers_submitted = db.IntegerProperty()
+
def get_breadcrumb(self):
if self.breadcrumb_persisted:
return self.breadcrumb_persisted
@@ -243,6 +247,7 @@ class Attempt(db.Model):
class Jeeqser_Challenge(db.Model):
"""
Represents the relation between a Jeeqser and a Challenge
+ Exists in the same entity group as the jeeqser
"""
jeeqser = db.ReferenceProperty(Jeeqser)
@@ -258,9 +263,11 @@ class Jeeqser_Challenge(db.Model):
status = db.StringProperty(choices=['correct', 'incorrect'])
-#TODO: move feedback to the same entity group as a submission
class Feedback(db.Model):
- """Models feedback for submission """
+ """Models feedback for submission
+ Belongs to the same entity group as the attempt for which it is for.
+ """
+
attempt = db.ReferenceProperty(Attempt, collection_name='feedbacks')
author = db.ReferenceProperty(Jeeqser, collection_name='feedback_out')
# Denormalizing the attempt author
View
1  src/program_tester.py
@@ -114,6 +114,7 @@ def run_testcases(program, challenge, attempt, robot):
vote = 'incorrect'
feedback = Feedback(
+ parent=attempt,
attempt=attempt,
author=robot,
attempt_author=attempt.author,
View
28 src/templates/home.html
@@ -47,16 +47,28 @@
<td></td>
</tr>
{% for challenge in challenges %}
- <tr {% if challenge.status == 'correct' %}
- style="background: #90ee90"
- {% endif %}
- {% if challenge.status == 'incorrect' %}
- style="background: #f08080"
- {% endif %}>
+ <tr>
<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 %}
+ {% if challenge.automatic_review %} <span title="Jeeqs will reviews this!" class="ui-icon ui-icon-transferthick-e-w" style="float:left"></span>{% endif %}
+ <a class="noline" href="/challenge/?ch={{ challenge.key }}" style="color:
+ {% if challenge.status == 'correct' %}
+ #089619
+ {% endif %}
+ {% if challenge.status == 'incorrect' %}
+ #960D22
+ {% endif %}
+ ">
+ {{ challenge.name }}
</a>
+ <br/>
+ <span style="color: #808080; font-size: smaller; float:left; margin-left: 20px">
+ <span class="ui-icon ui-icon-triangle-1-e" style="float:left"></span>
+ <span style="float:left">
+ <span title="jeeqsers solved this challenge" style="color:green"> {{ challenge.num_jeeqsers_solved|default_if_none:"0"}}</span>
+ /
+ <span title="jeeqsers submitted a solution for this challenge"> {{ challenge.num_jeeqsers_submitted|default_if_none:"0" }}</span>
+ </span>
+ </span>
</td>
<td>
<span>
Please sign in to comment.
Something went wrong with that request. Please try again.