refactor: rename endpoint to events_per_day
This commit is contained in:
@@ -23,7 +23,7 @@ const StatPage = () => {
|
||||
useEffect(() => {
|
||||
// Posts per Day
|
||||
axios
|
||||
.get("http://localhost:5000/stats/posts_per_day")
|
||||
.get("http://localhost:5000/stats/events_per_day")
|
||||
.then(res => {
|
||||
setData(res.data.filter((item: any) => new Date(item.date) >= new Date("2025-06-01")));
|
||||
setLoading(false);
|
||||
|
||||
@@ -34,7 +34,7 @@ def upload_data():
|
||||
|
||||
return jsonify({"message": "File uploaded successfully", "event_count": len(stat_obj.df)}), 200
|
||||
|
||||
@app.route('/stats/posts_per_day', methods=['GET'])
|
||||
@app.route('/stats/events_per_day', methods=['GET'])
|
||||
def posts_per_day():
|
||||
if stat_obj is None:
|
||||
return jsonify({"error": "No data uploaded"}), 400
|
||||
|
||||
@@ -66,7 +66,7 @@ class StatGen:
|
||||
|
||||
return (
|
||||
self.df
|
||||
.groupby(["weekday", "hour"])
|
||||
.groupby(["weekday", "hour"], observed=True)
|
||||
.size()
|
||||
.unstack(fill_value=0)
|
||||
.reindex(columns=range(24), fill_value=0)
|
||||
|
||||
Reference in New Issue
Block a user