more knob twiddling

This commit is contained in:
codl 2017-12-28 15:30:02 +01:00
parent e6a582431d
commit b11ffbbc11
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
1 changed files with 8 additions and 9 deletions

View File

@ -337,12 +337,12 @@ def update_mastodon_instances_popularity():
instance = MastodonInstance(instance=acct.mastodon_instance,
popularity=10)
db.session.add(instance)
amount = 0.001
amount = 0.01
if acct.policy_enabled:
amount = 0.05
amount = 0.5
for _ in acct.sessions:
amount += 0.01
instance.bump(amount / instance.popularity)
amount += 0.1
instance.bump(amount / max(1, instance.popularity))
# normalise scores so the top is 20
@ -350,11 +350,10 @@ def update_mastodon_instances_popularity():
db.session.query(db.func.max(MastodonInstance.popularity))
.scalar()
)
if top_pop > 20.1:
MastodonInstance.query.update({
MastodonInstance.popularity:
MastodonInstance.popularity * 20 / top_pop
})
MastodonInstance.query.update({
MastodonInstance.popularity:
MastodonInstance.popularity * 20 / top_pop
})
db.session.commit()