refactor: rename endpoint to events_per_day

This commit is contained in:
2026-01-28 19:48:37 +00:00
parent 85bcdb336b
commit 506ef3bd46
3 changed files with 3 additions and 3 deletions

View File

@@ -23,7 +23,7 @@ const StatPage = () => {
useEffect(() => { useEffect(() => {
// Posts per Day // Posts per Day
axios axios
.get("http://localhost:5000/stats/posts_per_day") .get("http://localhost:5000/stats/events_per_day")
.then(res => { .then(res => {
setData(res.data.filter((item: any) => new Date(item.date) >= new Date("2025-06-01"))); setData(res.data.filter((item: any) => new Date(item.date) >= new Date("2025-06-01")));
setLoading(false); setLoading(false);

View File

@@ -34,7 +34,7 @@ def upload_data():
return jsonify({"message": "File uploaded successfully", "event_count": len(stat_obj.df)}), 200 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(): def posts_per_day():
if stat_obj is None: if stat_obj is None:
return jsonify({"error": "No data uploaded"}), 400 return jsonify({"error": "No data uploaded"}), 400

View File

@@ -66,7 +66,7 @@ class StatGen:
return ( return (
self.df self.df
.groupby(["weekday", "hour"]) .groupby(["weekday", "hour"], observed=True)
.size() .size()
.unstack(fill_value=0) .unstack(fill_value=0)
.reindex(columns=range(24), fill_value=0) .reindex(columns=range(24), fill_value=0)