mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-10 15:07:35 +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):
|
||||
import datetime
|
||||
|
||||
self.score = 0
|
||||
self.score = 10
|
||||
|
||||
if self.forums is None:
|
||||
return
|
||||
if self.forums is not None:
|
||||
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 topic:
|
||||
days = (datetime.datetime.now() - topic.created_at).days
|
||||
months = days / 30
|
||||
years = days / 365
|
||||
self.score = topic.views / years + 80*min(6, months)
|
||||
if self.getMainScreenshotURL() is None:
|
||||
self.score *= 0.8
|
||||
|
||||
if not self.license.is_foss or not self.media_license.is_foss:
|
||||
self.score *= 0.1
|
||||
|
||||
class MetaPackage(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
|
Loading…
Reference in New Issue
Block a user