mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-02 16:21:32 -08:00
fix post ranking
This commit is contained in:
parent
0b3a63cf59
commit
872fdb9364
2 changed files with 5 additions and 3 deletions
|
@ -62,6 +62,9 @@
|
|||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<a class="w-100 btn btn-primary" href="/community/{{ community.link() }}/submit">{{ _('Create a post') }}</a>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
{% if current_user.is_authenticated and community_membership(current_user, community) == SUBSCRIPTION_MEMBER %}
|
||||
<a class="w-100 btn btn-primary" href="/community/{{ community.link() }}/unsubscribe">{{ _('Leave') }}</a>
|
||||
|
@ -71,9 +74,6 @@
|
|||
<a class="w-100 btn btn-primary" href="/community/{{ community.link() }}/subscribe">{{ _('Join') }}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<a class="w-100 btn btn-primary" href="/community/{{ community.link() }}/submit">{{ _('Create a post') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
<form method="get">
|
||||
<input type="search" name="search" class="form-control mt-2" placeholder="{{ _('Search this community') }}" />
|
||||
|
|
|
@ -467,6 +467,8 @@ def epoch_seconds(date):
|
|||
def post_ranking(score, date: datetime):
|
||||
if date is None:
|
||||
date = datetime.utcnow()
|
||||
if score is None:
|
||||
score = 1
|
||||
order = math.log(max(abs(score), 1), 10)
|
||||
sign = 1 if score > 0 else -1 if score < 0 else 0
|
||||
seconds = epoch_seconds(date) - 1685766018
|
||||
|
|
Loading…
Add table
Reference in a new issue