Skip to content

Commit

Permalink
update api
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexye committed Dec 29, 2023
1 parent fa25ed0 commit 5206e98
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ async def get_peer_history(peer_id: int, page: int = Query(0, alias="page")):
Args:
peer_id (int): The id of the peer.
page (int): The page number."""
async with app.db_connection.execute("SELECT * FROM peer_history WHERE peer_id=? ORDER BY timestamp DESC LIMIT 50 OFFSET ?", (peer_id, page * 50)) as cursor:
async with app.db_connection.execute("SELECT * FROM peer_history WHERE peer_id=? ORDER BY timestamp ASC LIMIT 50 OFFSET ?", (peer_id, page * 50)) as cursor:
total_pages = await app.db_connection.execute("SELECT COUNT(*) FROM peer_history WHERE peer_id=?", (peer_id,))
total_pages = await total_pages.fetchone()
total_pages = total_pages[0] / 50
Expand Down
6 changes: 1 addition & 5 deletions website/templates/node.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,7 @@ <h2 class="text-center">UPTIME CHART</h2>
label: 'Uptime',
data: [
{% for data in history %}
{% if data.online %}
1,
{% else %}
0,
{% endif %}
{{ data.online }},
{% endfor %}
],
backgroundColor: [
Expand Down

0 comments on commit 5206e98

Please sign in to comment.