]> git.ipfire.org Git - people/jschlag/pbs.git/commitdiff
Rename credits to scores
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 21 Oct 2017 15:24:03 +0000 (16:24 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 21 Oct 2017 15:24:03 +0000 (16:24 +0100)
This has been called score in half the software and credits
in the other half.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/builds.py
src/buildservice/logs.py
src/database.sql
src/hub/handlers.py
src/templates/build-detail.html
src/templates/modules/log-entry-comment.html
src/templates/modules/repo-actions-table.html

index 218f9c89b08071d5b5920eaff94803bb75fe52da..8da51062d7b8b897a8e3da07ee287b407064422e 100644 (file)
@@ -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 \
index 716991aea53efbdd5003fcffcf79816da6ef273a..f8f8c710a024ce2cd0a5d649a3f2e0e4dd35bdde 100644 (file)
@@ -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"
index ad24c09a2857b6612a4a87c40da3eab9ab3b32f2..f03c6dd719240783ab4ce1e816d42d1d45ea27f8 100644 (file)
@@ -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
 );
index 7b26e691457c47873ebe0ba56fa2800b0c32330e..c51d9ad2c6bd4a4f24a81121d6fa4dc396891237 100644 (file)
@@ -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,
index 60b24f6b6ce88f13f04babdd2cbb477a5e41e5bd..0d53c15849be33a378123d5e203ccb049453cd11 100644 (file)
                        <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>
 
index 126738de57a7c2a786e4a719897fc903f1f89b61..ff425c80377440873268ed2ecaa7f9ccd19ed28d 100644 (file)
@@ -3,12 +3,12 @@
 {% 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>
                &dash;
        {% 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>
                &dash;
        {% end %}
index 900b2db10c20b780bf1c8210763c369012cf233a..a59611e3e3a200d332eec02ebddab8fc32abb675 100644 (file)
 
                        <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 %}