Lots of improvements and adding a script to post to reddit.

This commit is contained in:
2025-07-22 16:26:40 +02:00
parent d4ed76e153
commit f6ea86fa91
8 changed files with 384 additions and 119 deletions

View File

@@ -1,14 +1,14 @@
# rstat_tool/dashboard.py
from flask import Flask, render_template
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from .logger_setup import get_logger
from .database import (
get_overall_summary,
get_subreddit_summary,
get_all_scanned_subreddits,
get_deep_dive_details,
get_image_view_summary,
get_daily_summary_for_subreddit,
get_weekly_summary_for_subreddit,
get_overall_image_view_summary
)
@@ -55,13 +55,13 @@ def deep_dive(symbol):
posts = get_deep_dive_details(symbol)
return render_template("deep_dive.html", posts=posts, symbol=symbol)
@app.route("/image/<name>")
def image_view(name):
@app.route("/image/daily/<name>")
def daily_image_view(name):
"""The handler for the image-style dashboard."""
tickers = get_image_view_summary(name)
current_date = datetime.utcnow().strftime("%Y-%m-%d")
tickers = get_daily_summary_for_subreddit(name)
current_date = datetime.now(timezone.utc).strftime("%Y-%m-%d")
return render_template(
"image_view.html",
"daily_image_view.html",
tickers=tickers,
subreddit_name=name,
current_date=current_date
@@ -73,7 +73,7 @@ def weekly_image_view(name):
tickers = get_weekly_summary_for_subreddit(name)
# Create the date range string for the title
end_date = datetime.utcnow()
end_date = datetime.now(timezone.utc)
start_date = end_date - timedelta(days=7)
date_range_str = f"{start_date.strftime('%b %d')} - {end_date.strftime('%b %d, %Y')}"
@@ -88,7 +88,7 @@ def weekly_image_view(name):
def overall_image_view():
"""The handler for the overall image-style dashboard."""
tickers = get_overall_image_view_summary()
current_date = datetime.utcnow().strftime("%Y-%m-%d")
current_date = datetime.now(timezone.utc).strftime("%Y-%m-%d")
return render_template(
"overall_image_view.html",
tickers=tickers,