Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar_network/model/context.py
diff options
context:
space:
mode:
Diffstat (limited to 'sugar_network/model/context.py')
-rw-r--r--sugar_network/model/context.py17
1 files changed, 2 insertions, 15 deletions
diff --git a/sugar_network/model/context.py b/sugar_network/model/context.py
index 872d74d..85d9be8 100644
--- a/sugar_network/model/context.py
+++ b/sugar_network/model/context.py
@@ -115,25 +115,12 @@ class Context(db.Resource):
def downloads(self, value):
return value
- @db.indexed_property(slot=3, typecast=model.RATINGS, default=0,
+ @db.indexed_property(slot=3, typecast=[], default=[0, 0],
+ sortable_serialise=lambda x: float(x[1]) / x[0] if x[0] else 0,
acl=ACL.READ | ACL.CALC)
def rating(self, value):
return value
- @db.stored_property(typecast=[], default=[0, 0], acl=ACL.READ | ACL.CALC)
- def reviews(self, value):
- if value is None:
- return 0
- else:
- return value[0]
-
- @reviews.setter
- def reviews(self, value):
- if isinstance(value, int):
- return [value, 0]
- else:
- return value
-
@db.stored_property(typecast=[], default=[], acl=ACL.PUBLIC | ACL.LOCAL)
def dependencies(self, value):
"""Software dependencies.