Fixed datamap and statistical tests
All checks were successful
ci/woodpecker/release/woodpecker Pipeline was successful

This commit is contained in:
GeorgeWebberley 2026-02-04 16:10:55 +01:00
parent be17df22f0
commit af4fde1c18
2 changed files with 16 additions and 5 deletions

View file

@ -155,8 +155,8 @@ def run_tests(survey_id):
@login_required @login_required
def findings(): def findings():
form = EditForm() form = EditForm()
notifications = mongo.db.temp_results.find({"user": current_user._id}) notifications = list(mongo.db.temp_results.find({"user": current_user._id}))
# If user chooses to save a test
if form.validate_on_submit(): if form.validate_on_submit():
result_id = request.args.get("result_id") result_id = request.args.get("result_id")
mongo.db.tests.insert_one({ mongo.db.tests.insert_one({
@ -168,10 +168,14 @@ def findings():
"dependentVariable" : request.args.get("dependent_variable"), "dependentVariable" : request.args.get("dependent_variable"),
"p" : request.args.get("p")}) "p" : request.args.get("p")})
mongo.db.temp_results.delete_one({'_id': ObjectId(result_id)}) 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") flash("Statistical test saved to your survey dashboard", "success")
return redirect(url_for("surveys.findings")) 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 # Delete a temporary result

View file

@ -48,6 +48,11 @@
<script src="https://cdn.jsdelivr.net/npm/handsontable@7.4.2/dist/handsontable.full.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/handsontable@7.4.2/dist/handsontable.full.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/handsontable@7.4.2/dist/handsontable.full.min.css" rel="stylesheet" media="screen"> <link href="https://cdn.jsdelivr.net/npm/handsontable@7.4.2/dist/handsontable.full.min.css" rel="stylesheet" media="screen">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.9/topojson.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datamaps/0.5.9/datamaps.all.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/save-svg-as-png@1.4.17/lib/saveSvgAsPng.min.js"></script>
<script src="https://unpkg.com/canvg@3.0.4/lib/umd.js"></script>
{{ JSGlue.include() }} {{ JSGlue.include() }}
</head> </head>
@ -106,5 +111,7 @@
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
{% block content %} {% endblock %} {% block content %} {% endblock %}
</body> </body>
</html> </html>