fix: missing variable in job_details()
This commit is contained in:
15
web/app.py
15
web/app.py
@@ -2,6 +2,7 @@ import os
|
|||||||
from flask import Flask, request, jsonify, render_template, redirect, url_for, session, flash, Response
|
from flask import Flask, request, jsonify, render_template, redirect, url_for, session, flash, Response
|
||||||
from flask_wtf import CSRFProtect
|
from flask_wtf import CSRFProtect
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
from web.craigslist import scraper
|
from web.craigslist import scraper
|
||||||
from web.db import (
|
from web.db import (
|
||||||
@@ -35,6 +36,7 @@ from web.utils import (
|
|||||||
initialize_users_from_settings,
|
initialize_users_from_settings,
|
||||||
filter_jobs,
|
filter_jobs,
|
||||||
get_job_by_id,
|
get_job_by_id,
|
||||||
|
now_iso,
|
||||||
)
|
)
|
||||||
from web.db import get_all_regions, get_all_keywords
|
from web.db import get_all_regions, get_all_keywords
|
||||||
|
|
||||||
@@ -204,9 +206,9 @@ def job_details():
|
|||||||
if session.get('username'):
|
if session.get('username'):
|
||||||
try:
|
try:
|
||||||
r = set(get_user_regions(session['username']))
|
r = set(get_user_regions(session['username']))
|
||||||
k = set(get_user_keywords(session['username']))
|
|
||||||
if r:
|
if r:
|
||||||
jobs = [j for j in jobs if j.get('region') in r]
|
jobs = [j for j in jobs if j.get('region') in r]
|
||||||
|
k = set(get_user_keywords(session['username']))
|
||||||
if k:
|
if k:
|
||||||
jobs = [j for j in jobs if j.get('keyword') in k]
|
jobs = [j for j in jobs if j.get('keyword') in k]
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -516,6 +518,17 @@ def admin_stats():
|
|||||||
return render_template('admin/stats.html', title='Statistics', stats=stats, jobs=jobs, regions=get_all_regions(), keywords=get_all_keywords())
|
return render_template('admin/stats.html', title='Statistics', stats=stats, jobs=jobs, regions=get_all_regions(), keywords=get_all_keywords())
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/health', methods=['GET'])
|
||||||
|
def health_check():
|
||||||
|
"""Health check endpoint for monitoring application status."""
|
||||||
|
return jsonify({
|
||||||
|
"status": "healthy",
|
||||||
|
"timestamp": now_iso(),
|
||||||
|
"service": "jobs-scraper",
|
||||||
|
"version": "1.0.0"
|
||||||
|
}), 200
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Main function to run the Flask app."""
|
"""Main function to run the Flask app."""
|
||||||
# Ensure DB is initialized
|
# Ensure DB is initialized
|
||||||
|
|||||||
Reference in New Issue
Block a user