Add deep dive function to get more into each single stock.
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
# rstat_tool/dashboard.py
|
||||
|
||||
from flask import Flask, render_template
|
||||
# --- FIX #1: Import the new function we need ---
|
||||
from .database import (
|
||||
get_overall_summary,
|
||||
get_subreddit_summary,
|
||||
get_all_scanned_subreddits
|
||||
get_all_scanned_subreddits,
|
||||
get_deep_dive_details
|
||||
)
|
||||
|
||||
app = Flask(__name__, template_folder='../templates')
|
||||
@@ -32,17 +34,22 @@ def inject_subreddits():
|
||||
@app.route("/")
|
||||
def index():
|
||||
"""The handler for the main dashboard page."""
|
||||
# --- CHANGE HERE: Limit the data to the top 10 ---
|
||||
tickers = get_overall_summary(limit=10)
|
||||
return render_template("index.html", tickers=tickers)
|
||||
|
||||
@app.route("/subreddit/<name>")
|
||||
def subreddit_dashboard(name):
|
||||
"""A dynamic route for per-subreddit dashboards."""
|
||||
# --- CHANGE HERE: Limit the data to the top 10 ---
|
||||
tickers = get_subreddit_summary(name, limit=10)
|
||||
return render_template("subreddit.html", tickers=tickers, subreddit_name=name)
|
||||
|
||||
@app.route("/deep-dive/<symbol>")
|
||||
def deep_dive(symbol):
|
||||
"""The handler for the deep-dive page for a specific ticker."""
|
||||
# --- FIX #2: Call the function directly, without the 'database.' prefix ---
|
||||
posts = get_deep_dive_details(symbol)
|
||||
return render_template("deep_dive.html", posts=posts, symbol=symbol)
|
||||
|
||||
def start_dashboard():
|
||||
"""The main function called by the 'rstat-dashboard' command."""
|
||||
print("Starting Flask server...")
|
||||
|
Reference in New Issue
Block a user