def add_comment(self, user, text, score):
# Add the new comment to the database.
id = self.db.execute("INSERT INTO \
- builds_comments(build_id, user_id, text, credit, time_created) \
+ builds_comments(build_id, user_id, text, score, time_created) \
VALUES(%s, %s, %s, %s, NOW())",
self.id, user.id, text, score)
- # Update the credit cache
+ # Update the score cache
self.score += score
# Send the new comment to all watchers and stuff.
@lazy_property
def score(self):
- res = self.db.get("SELECT SUM(credit) AS score \
+ res = self.db.get("SELECT SUM(score) AS score \
FROM builds_comments WHERE build_id = %s", self.id)
return res.score or 0
- @property
- def credits(self):
- # XXX COMPAT
- return self.score
-
def get_commenters(self):
users = self.db.query("SELECT DISTINCT users.id AS id FROM builds_comments \
JOIN users ON builds_comments.user_id = users.id \
return self.data.time_created
@property
- def credit(self):
- return self.data.credit
+ def score(self):
+ return self.data.score
@property
def build_id(self):
@property
def vote(self):
- if self.credit > 0:
+ if self.score > 0:
return "up"
- elif self.credit < 0:
+ elif self.score < 0:
return "down"
return "none"
build_id integer NOT NULL,
user_id integer NOT NULL,
text text NOT NULL,
- credit integer NOT NULL,
+ score integer NOT NULL,
time_created timestamp without time zone NOT NULL,
time_updated timestamp without time zone
);
"name" : build.name,
"package" : build.pkg.uuid,
"priority" : build.priority,
- "score" : build.credits,
+ "score" : build.score,
"severity" : build.severity,
"state" : build.state,
"sup_arches" : build.supported_arches,
<div class="row-fluid">
<div class="span3">
<div class="well well-large well-white ac">
- <p class="huge {% if build.credits >= 0 %}text-success{% else %}text-error{% end %}">
- {% if build.credits > 0 %}
- +{{ build.credits }}
+ <p class="huge {% if build.score >= 0 %}text-success{% else %}text-error{% end %}">
+ {% if build.score > 0 %}
+ +{{ build.score }}
{% else %}
- {{ build.credits }}
+ {{ build.score }}
{% end %}
</p>
{% block extra-title %}
{% if entry.vote == "up" %}
<span class="label label-success" title="{{ _("This build works for %s.") % entry.user.firstname }}">
- +{{ entry.credit }}
+ +{{ entry.score }}
</span>
‐
{% elif entry.vote == "down" %}
<span class="label label-important" title="{{ _("This build does not work for %s.") % entry.user.firstname }}">
- {{ entry.credit }}
+ {{ entry.score }}
</span>
‐
{% end %}
<div id="action-info-{{ action.id }}">
<p>
- {% if action.credits_needed %}
- {{ _("%(credits)s more credit needed.", "%(credits)s more credits needed.", action.credits_needed) % { "credits" : action.credits_needed } }}
+ {% if action.score_needed %}
+ {{ _("One more score needed.", "%(score)s more scores needed.", action.score_needed) % { "score" : action.score_needed } }}
{% else %}
- {{ _("No more credits needed.") }}
+ {{ _("No more scores needed.") }}
{% end %}
<br />
{% if action.pkg.maintainer %}