return res.score or 0
+ def upvote(self, user, score=1):
+ # Creates an empty comment with a score
+ self.db.execute("INSERT INTO builds_comments(build_id, user_id, score) \
+ VALUES(%s, %s, %s)", self.id, user.id, score)
+
+ # Update cache
+ self.score += 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 \
# Import all packages in one swoop.
for pkg in pkgs:
with self.db.transaction():
- self.backend.builds.create_from_source_package(pkg,
+ build = self.backend.builds.create_from_source_package(pkg,
source.distro, commit=commit, type="release")
+ # Import any testers from the commit message
+ for tester in commit.testers:
+ build.upvote(tester)
+
except:
if commit:
commit.state = "failed"
return sorted(contributors + users)
+ @lazy_property
+ def testers(self):
+ users = []
+
+ for tag in ("Acked-by", "Reviewed-by", "Signed-off-by", "Tested-by"):
+ users += self.get_tag(tag)
+
+ return self.backend.users.find_maintainers(users)
+
@property
def date(self):
return self.data.date
id integer NOT NULL,
build_id integer NOT NULL,
user_id integer NOT NULL,
- text text NOT NULL,
+ text text,
score integer NOT NULL,
- time_created timestamp without time zone NOT NULL,
+ time_created timestamp without time zone DEFAULT now() NOT NULL,
time_updated timestamp without time zone
);