mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-25 15:31:37 +01:00
Update scoring algorithm to take licenses and screenshots into account
This commit is contained in:
parent
b8decafd75
commit
ed409df323
@ -514,17 +514,21 @@ class Package(db.Model):
|
|||||||
def recalcScore(self):
|
def recalcScore(self):
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
self.score = 0
|
self.score = 10
|
||||||
|
|
||||||
if self.forums is None:
|
if self.forums is not None:
|
||||||
return
|
topic = ForumTopic.query.get(self.forums)
|
||||||
|
if topic:
|
||||||
|
days = (datetime.datetime.now() - topic.created_at).days
|
||||||
|
months = days / 30
|
||||||
|
years = days / 365
|
||||||
|
self.score = topic.views / max(years, 0.0416) + 80*min(max(months, 0.5), 6)
|
||||||
|
|
||||||
topic = ForumTopic.query.get(self.forums)
|
if self.getMainScreenshotURL() is None:
|
||||||
if topic:
|
self.score *= 0.8
|
||||||
days = (datetime.datetime.now() - topic.created_at).days
|
|
||||||
months = days / 30
|
if not self.license.is_foss or not self.media_license.is_foss:
|
||||||
years = days / 365
|
self.score *= 0.1
|
||||||
self.score = topic.views / years + 80*min(6, months)
|
|
||||||
|
|
||||||
class MetaPackage(db.Model):
|
class MetaPackage(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user