Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
limited logs
Browse files Browse the repository at this point in the history
  • Loading branch information
leftmove committed May 27, 2024
1 parent 32f1dbf commit eecfc14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions routers/lib/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,13 @@ def add_log(cik, message, name="", identifier=""):
logs.update_one({"cik": cik}, {"$push": {"logs": log_string}})
else:
logs_string = [f"{log} ({name}) ({identifier})" for log in message.split("\n")]
logs.update_one({"cik": cik}, {"$push": {"logs": {"$each": logs_string}}})
logs.update_one(
{"cik": cik},
{
"$push": {"logs": {"$each": logs_string}},
"$set": {"logs": {"$slice": -100}},
},
)


def add_logs(cik, formatted_logs):
Expand All @@ -174,7 +180,10 @@ def add_logs(cik, formatted_logs):
]
)

logs.update_one({"cik": cik}, {"$push": {"logs": {"$each": logs_split}}})
logs.update_one(
{"cik": cik},
{"$push": {"logs": {"$each": logs_split}}, "$set": {"logs": {"$slice": -100}}},
)


def edit_log(cik, stamp):
Expand Down
2 changes: 1 addition & 1 deletion static/popular.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["1067983", "1649339", "1541617", "1336528", "1709323", "1536411", "1037389", "1791786", "1350694", "1167483"]
["1067983", "1649339", "1541617", "1336528", "1709323", "1536411", "1037389", "1791786", "1350694", "1167483", "1037389"]

0 comments on commit eecfc14

Please sign in to comment.