Skip to content

Commit e236d35

Browse files
committed
reversed the order of the posts in history
1 parent 4cf0108 commit e236d35

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

app.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -693,20 +693,19 @@ def logout():
693693

694694
@app.route("/history/")
695695
def history_redirect():
696-
num = math.ceil((int(stats["broadcast"]["id"])) / 5)
697-
return redirect(url_for("history", page=num))
696+
return redirect(url_for("history", page=1))
698697

699698

700699
@app.route("/history/<int:page>")
701700
def history(page):
702-
query_list = [f"p.id = '{post_id}'" for post_id in range((5 * page) - 4, (5 * page) + 1)]
701+
query_list = [f"p.id = '{post_id}'" for post_id in range(stats["broadcast"]["id"] - 6, stats["broadcast"]["id"])]
703702
query_str = " OR ".join(query_list)
704703

705704
try:
706705
query_result = post_container.query_items(f"SELECT * FROM Posts p WHERE {query_str}", enable_cross_partition_query=True)
707706
post_list = stuffimporter.itempaged_to_list(query_result)
708707
except StopIteration:
709-
post_list = []
708+
abort(404)
710709

711710
return render_template("history.html", post_list=reversed(post_list), hist_page=int(page))
712711

0 commit comments

Comments
 (0)