aboutsummaryrefslogtreecommitdiff
path: root/app/models.py
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2019-09-03 00:42:51 +0100
committerrubenwardy <rw@rubenwardy.com>2019-09-03 00:42:51 +0100
commit4082863b5a48fb6a66537591137361e18349996a (patch)
treead2a5ff1c4bed168eb60142d280615980f2f45f9 /app/models.py
parentcc564af44e1fc7b03fa4d2c8d6b00a07aad7b539 (diff)
downloadcheatdb-4082863b5a48fb6a66537591137361e18349996a.tar.xz
Add basic dependency resolutionv1.17.0
Diffstat (limited to 'app/models.py')
-rw-r--r--app/models.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models.py b/app/models.py
index a260154..9148f05 100644
--- a/app/models.py
+++ b/app/models.py
@@ -398,7 +398,7 @@ class Package(db.Model):
forums = db.Column(db.Integer, nullable=True)
provides = db.relationship("MetaPackage", secondary=provides, lazy="subquery",
- backref=db.backref("packages", lazy="dynamic"))
+ backref=db.backref("packages", lazy="dynamic", order_by=db.desc("score")))
dependencies = db.relationship("Dependency", backref="depender", lazy="dynamic", foreign_keys=[Dependency.depender_id])
@@ -441,6 +441,13 @@ class Package(db.Model):
else:
return "ready"
+ def getAsDictionaryKey(self):
+ return {
+ "name": self.name,
+ "author": self.author.display_name,
+ "type": self.type.toName(),
+ }
+
def getAsDictionaryShort(self, base_url, version=None, protonum=None):
tnurl = self.getThumbnailURL(1)
release = self.getDownloadRelease(version=version, protonum=protonum)