From af4fde1c18cc65cf49255cddb7bd12af6bae14d4 Mon Sep 17 00:00:00 2001 From: GeorgeWebberley Date: Wed, 4 Feb 2026 16:10:55 +0100 Subject: [PATCH] Fixed datamap and statistical tests --- site/surveyapp/surveys/routes.py | 12 ++++++++---- site/surveyapp/templates/layout.html | 9 ++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/site/surveyapp/surveys/routes.py b/site/surveyapp/surveys/routes.py index afb779c..a93c3e7 100644 --- a/site/surveyapp/surveys/routes.py +++ b/site/surveyapp/surveys/routes.py @@ -155,8 +155,8 @@ def run_tests(survey_id): @login_required def findings(): form = EditForm() - notifications = mongo.db.temp_results.find({"user": current_user._id}) - # If user chooses to save a test + notifications = list(mongo.db.temp_results.find({"user": current_user._id})) + if form.validate_on_submit(): result_id = request.args.get("result_id") mongo.db.tests.insert_one({ @@ -168,10 +168,14 @@ def findings(): "dependentVariable" : request.args.get("dependent_variable"), "p" : request.args.get("p")}) mongo.db.temp_results.delete_one({'_id': ObjectId(result_id)}) - notifications = mongo.db.temp_results.find({"user": current_user._id}) + notifications = list(mongo.db.temp_results.find({"user": current_user._id})) flash("Statistical test saved to your survey dashboard", "success") return redirect(url_for("surveys.findings")) - return render_template("surveys/findings.html", title="Findings", form=form, notifications=notifications, count=notifications.count()) + return render_template("surveys/findings.html", + title="Findings", + form=form, + notifications=notifications, + count=len(notifications)) # Delete a temporary result diff --git a/site/surveyapp/templates/layout.html b/site/surveyapp/templates/layout.html index 43adbc3..11b6210 100644 --- a/site/surveyapp/templates/layout.html +++ b/site/surveyapp/templates/layout.html @@ -47,7 +47,12 @@ - + + + + + + {{ JSGlue.include() }} @@ -106,5 +111,7 @@ {% block content %} {% endblock %} + +