twiddle the knob
This commit is contained in:
parent
34b6f622a1
commit
02b564283f
|
@ -36,7 +36,7 @@ def index():
|
||||||
def about():
|
def about():
|
||||||
instances = (
|
instances = (
|
||||||
MastodonInstance.query
|
MastodonInstance.query
|
||||||
.filter(MastodonInstance.popularity > 13)
|
.filter(MastodonInstance.popularity > 5)
|
||||||
.order_by(db.desc(MastodonInstance.popularity),
|
.order_by(db.desc(MastodonInstance.popularity),
|
||||||
MastodonInstance.instance)
|
MastodonInstance.instance)
|
||||||
.limit(5).all())
|
.limit(5).all())
|
||||||
|
|
25
tasks.py
25
tasks.py
|
@ -291,19 +291,18 @@ 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)
|
||||||
print('bamp {}'.format(instance.instance))
|
instance.bump(0.001)
|
||||||
instance.bump(0.01)
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
# normalise scores
|
# normalise scores so the median is 10
|
||||||
biggest_instance = (
|
median_pop = (
|
||||||
MastodonInstance.query
|
db.session.query(
|
||||||
.order_by(db.desc(MastodonInstance.popularity)).first())
|
db.func.percentile_cont(0.5)
|
||||||
if biggest_instance.popularity > 40:
|
.within_group(MastodonInstance.popularity.desc())).scalar()
|
||||||
MastodonInstance.query.update({
|
)
|
||||||
MastodonInstance.popularity:
|
MastodonInstance.query.update({
|
||||||
MastodonInstance.popularity * 40 / biggest_instance.popularity
|
MastodonInstance.popularity:
|
||||||
})
|
MastodonInstance.popularity * 10 / median_pop
|
||||||
|
})
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
|
@ -312,7 +311,7 @@ app.add_periodic_task(40, queue_fetch_for_most_stale_accounts)
|
||||||
app.add_periodic_task(17, queue_deletes)
|
app.add_periodic_task(17, queue_deletes)
|
||||||
app.add_periodic_task(60, refresh_account_with_oldest_post)
|
app.add_periodic_task(60, refresh_account_with_oldest_post)
|
||||||
app.add_periodic_task(180, refresh_account_with_longest_time_since_refresh)
|
app.add_periodic_task(180, refresh_account_with_longest_time_since_refresh)
|
||||||
app.add_periodic_task(60, update_mastodon_instances_popularity)
|
app.add_periodic_task(61, update_mastodon_instances_popularity)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.worker_main()
|
app.worker_main()
|
||||||
|
|
Loading…
Reference in New Issue