From d31d17af0f9a982f1bf5c46a10c43a64442a856e Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 21 Oct 2017 16:24:03 +0100 Subject: [PATCH] Rename credits to scores This has been called score in half the software and credits in the other half. Signed-off-by: Michael Tremer --- src/buildservice/builds.py | 11 +++-------- src/buildservice/logs.py | 8 ++++---- src/database.sql | 2 +- src/hub/handlers.py | 2 +- src/templates/build-detail.html | 8 ++++---- src/templates/modules/log-entry-comment.html | 4 ++-- src/templates/modules/repo-actions-table.html | 6 +++--- 7 files changed, 18 insertions(+), 23 deletions(-) diff --git a/src/buildservice/builds.py b/src/buildservice/builds.py index 218f9c8..8da5106 100644 --- a/src/buildservice/builds.py +++ b/src/buildservice/builds.py @@ -844,11 +844,11 @@ class Build(base.DataObject): 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. @@ -859,16 +859,11 @@ class Build(base.DataObject): @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 \ diff --git a/src/buildservice/logs.py b/src/buildservice/logs.py index 716991a..f8f8c71 100644 --- a/src/buildservice/logs.py +++ b/src/buildservice/logs.py @@ -75,8 +75,8 @@ class CommentLogEntry(LogEntry): 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): @@ -88,9 +88,9 @@ class CommentLogEntry(LogEntry): @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" diff --git a/src/database.sql b/src/database.sql index ad24c09..f03c6dd 100644 --- a/src/database.sql +++ b/src/database.sql @@ -746,7 +746,7 @@ CREATE TABLE builds_comments ( 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 ); diff --git a/src/hub/handlers.py b/src/hub/handlers.py index 7b26e69..c51d9ad 100644 --- a/src/hub/handlers.py +++ b/src/hub/handlers.py @@ -312,7 +312,7 @@ class BuildsGetHandler(BaseHandler): "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, diff --git a/src/templates/build-detail.html b/src/templates/build-detail.html index 60b24f6..0d53c15 100644 --- a/src/templates/build-detail.html +++ b/src/templates/build-detail.html @@ -29,11 +29,11 @@
-

- {% if build.credits > 0 %} - +{{ build.credits }} +

+ {% if build.score > 0 %} + +{{ build.score }} {% else %} - {{ build.credits }} + {{ build.score }} {% end %}

diff --git a/src/templates/modules/log-entry-comment.html b/src/templates/modules/log-entry-comment.html index 126738d..ff425c8 100644 --- a/src/templates/modules/log-entry-comment.html +++ b/src/templates/modules/log-entry-comment.html @@ -3,12 +3,12 @@ {% block extra-title %} {% if entry.vote == "up" %} - +{{ entry.credit }} + +{{ entry.score }} ‐ {% elif entry.vote == "down" %} - {{ entry.credit }} + {{ entry.score }} ‐ {% end %} diff --git a/src/templates/modules/repo-actions-table.html b/src/templates/modules/repo-actions-table.html index 900b2db..a59611e 100644 --- a/src/templates/modules/repo-actions-table.html +++ b/src/templates/modules/repo-actions-table.html @@ -15,10 +15,10 @@

- {% 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 %}
{% if action.pkg.maintainer %} -- 2.47.3