From 6dbe3932de1355db858aec84f3095efbc44d9bdb Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Wed, 28 Feb 2024 14:13:59 -0600 Subject: [PATCH] Fix cache + problem pdf --- templates/problem/feed/problems.html | 2 +- templates/problem/problem.html | 12 +++++++----- templates/user/users-table.html | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/templates/problem/feed/problems.html b/templates/problem/feed/problems.html index add8566..df898cb 100644 --- a/templates/problem/feed/problems.html +++ b/templates/problem/feed/problems.html @@ -30,7 +30,7 @@ {% endif %}
- {% cache 86400 'problem_html' problem.id MATH_ENGINE LANGUAGE_CODE %} + {% cache 86400 'problem_html' problem.id LANGUAGE_CODE %} {{ problem.description|markdown(lazy_load=True)|reference|str|safe }} {% endcache %} {% if problem.pdf_description %} diff --git a/templates/problem/problem.html b/templates/problem/problem.html index 3d6d74a..1bf4ab9 100644 --- a/templates/problem/problem.html +++ b/templates/problem/problem.html @@ -65,13 +65,15 @@ e.preventDefault(); if (!$('#raw_problem').attr('src')) { $('#raw_problem').attr('src', '{{problem.code}}/raw') + $('#raw_problem').on('load', function() { + renderKatex(frames['raw_problem'].document); + frames['raw_problem'].print(); + }); } - // while(!$('.math-loaded', frames['raw_problem'].document).length){ - // await new Promise(r => setTimeout(r, 200)); - // } - setTimeout(() => { + else { frames['raw_problem'].print(); - }, 1000); + return; + } }); $('#clarification_header').on('click', function() { $('#clarification_header_container').hide(); diff --git a/templates/user/users-table.html b/templates/user/users-table.html index 606e374..f4a7013 100644 --- a/templates/user/users-table.html +++ b/templates/user/users-table.html @@ -39,7 +39,7 @@ {{ user.problem_count }}
- {% cache 86400 'user_about' user.id MATH_ENGINE %} + {% cache 86400 'user_about' user.id %} {% if user.about %} {{ user.about|markdown(lazy_load=True)|reference|str|safe }} {% endif %}