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