-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1787 from He3lixxx/results-caching
Allow running refresh_results_cache during normal operation, with each cache update happening atomically
- Loading branch information
Showing
8 changed files
with
138 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,8 @@ | ||
{% load cache %} | ||
{% load i18n %} | ||
|
||
{% load evaluation_filters %} | ||
{% load results_templatetags %} | ||
|
||
{% get_current_language as LANGUAGE_CODE %} | ||
|
||
{% cache None course_result_template_fragment course.id LANGUAGE_CODE using="results" %} | ||
|
||
<div class="results-grid-row heading-row course-row"> | ||
<div data-col="name" data-order="{{ course.name|lower }}"> | ||
<div> | ||
{% for degree in course.degrees.all %} | ||
<span class="badge bg-primary badge-degree">{{ degree }}</span> | ||
{% endfor %} | ||
<span class="badge bg-secondary badge-course-type">{{ course.type }}</span> | ||
</div> | ||
<span class="evaluation-name">{{ course.name }}</span> | ||
</div> | ||
<div data-col="semester" data-order="{{ course.semester.id }}" class="text-center semester-short-name"> | ||
{{ course.semester.short_name }} | ||
</div> | ||
<div data-col="responsible" data-order="{{ course.responsibles.first.last_name|lower }}"> | ||
{{ course.responsibles_names }} | ||
</div> | ||
<div data-col="result" data-order="{{ course.avg_grade|default:7 }}"> | ||
{% if course.not_all_evaluations_are_published %} | ||
<div class="d-flex" data-bs-toggle="tooltip" data-bs-placement="left" title="{% trans 'Course result is not yet available.' %}"> | ||
{% include 'distribution_with_grade_disabled.html' with icon="fas fa-hourglass" %} | ||
</div> | ||
{% else %} | ||
{% include 'evaluation_result_widget.html' with course_or_evaluation=course %} | ||
{% endif %} | ||
</div> | ||
</div> | ||
|
||
{% include 'results_index_course_impl.html' %} | ||
{% endcache %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{% load evaluation_filters %} | ||
{% load results_templatetags %} | ||
|
||
<div class="results-grid-row heading-row course-row"> | ||
<div data-col="name" data-order="{{ course.name|lower }}"> | ||
<div> | ||
{% for degree in course.degrees.all %} | ||
<span class="badge bg-primary badge-degree">{{ degree }}</span> | ||
{% endfor %} | ||
<span class="badge bg-secondary badge-course-type">{{ course.type }}</span> | ||
</div> | ||
<span class="evaluation-name">{{ course.name }}</span> | ||
</div> | ||
<div data-col="semester" data-order="{{ course.semester.id }}" class="text-center semester-short-name"> | ||
{{ course.semester.short_name }} | ||
</div> | ||
<div data-col="responsible" data-order="{{ course.responsibles.first.last_name|lower }}"> | ||
{{ course.responsibles_names }} | ||
</div> | ||
<div data-col="result" data-order="{{ course.avg_grade|default:7 }}"> | ||
{% if course.not_all_evaluations_are_published %} | ||
<div class="d-flex" data-bs-toggle="tooltip" data-bs-placement="left" title="{% trans 'Course result is not yet available.' %}"> | ||
{% include 'distribution_with_grade_disabled.html' with icon="fas fa-hourglass" %} | ||
</div> | ||
{% else %} | ||
{% include 'evaluation_result_widget.html' with course_or_evaluation=course %} | ||
{% endif %} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,8 @@ | ||
{% load cache %} | ||
{% load i18n %} | ||
|
||
{% load evaluation_filters %} | ||
{% load results_templatetags %} | ||
|
||
{% get_current_language as LANGUAGE_CODE %} | ||
|
||
{% cache evaluation|evaluation_results_cache_timeout evaluation_result_template_fragment evaluation.id LANGUAGE_CODE links_to_results_page using="results" %} | ||
|
||
<{% if links_to_results_page %}a href="{% url 'results:evaluation_detail' evaluation.course.semester.id evaluation.id %}"{% else %}div{% endif %} | ||
class="results-grid-row {% if not is_subentry %}heading-row{% else %}evaluation-row{% endif %} | ||
{% if links_to_results_page %} hover-row{% endif %} | ||
{% if evaluation.State.IN_EVALUATION <= evaluation.state and evaluation.state < evaluation.State.PUBLISHED %} | ||
preview-row | ||
{% endif %}"> | ||
<div data-col="name"{% if not is_subentry %} data-order="{{ evaluation.course.name|lower }}"{% endif %}> | ||
<div> | ||
{% if is_subentry %} | ||
{% include 'evaluation_badges.html' with mode='subentry' %} | ||
{% else %} | ||
{% include 'evaluation_badges.html' %} | ||
{% endif %} | ||
</div> | ||
<span class="evaluation-name"> | ||
{% if is_subentry %} | ||
{% if evaluation.name %} | ||
{{ evaluation.name }} | ||
{% else %} | ||
{{ evaluation.course.name }} | ||
{% endif %} | ||
{% else %} | ||
{{ evaluation.full_name }} | ||
{% endif %} | ||
{% if evaluation.is_single_result %} ({{ evaluation.vote_start_datetime|date }}){% endif %} | ||
{% if evaluation.state == evaluation.State.IN_EVALUATION %} | ||
<span data-bs-toggle="tooltip" data-bs-placement="top" class="fas fa-play icon-gray" title="{% trans 'This evaluation is still running' %}"></span> | ||
{% elif evaluation.state == evaluation.State.EVALUATED %} | ||
<span data-bs-toggle="tooltip" data-bs-placement="top" class="fas fa-chart-simple icon-yellow" title="{% trans 'Results not yet published' %}"></span> | ||
{% elif evaluation.state == evaluation.State.REVIEWED %} | ||
{% if evaluation.is_single_result or evaluation.grading_process_is_finished %} | ||
<span data-bs-toggle="tooltip" data-bs-placement="top" class="fas fa-chart-simple icon-red" title="{% trans 'Results not yet published although grading process is finished' %}"></span> | ||
{% else %} | ||
<span data-bs-toggle="tooltip" data-bs-placement="top" class="fas fa-chart-simple icon-yellow" title="{% trans 'Results not yet published' %}"></span> | ||
{% endif %} | ||
{% endif %} | ||
</span> | ||
</div> | ||
{% if not is_subentry %} | ||
<div data-col="semester" data-order="{{ evaluation.course.semester.id }}" class="text-center semester-short-name"> | ||
{{ evaluation.course.semester.short_name }} | ||
</div> | ||
{% endif %} | ||
{% if not is_subentry %} | ||
<div data-col="responsible" data-order="{{ evaluation.course.responsibles.first.last_name|lower }}"> | ||
{{ evaluation.course.responsibles_names }} | ||
</div> | ||
{% endif %} | ||
{% if evaluation.is_single_result %} | ||
<div data-col="participants" class="text-center"><span class="fas fa-user"></span> {{ evaluation.single_result_rating_result.count_sum }}</div> | ||
{% else %} | ||
{% with num_participants=evaluation.num_participants num_voters=evaluation.num_voters %} | ||
<div data-col="participants">{% include 'progress_bar.html' with done=num_voters total=num_participants %}</div> | ||
{% endwith %} | ||
{% endif %} | ||
|
||
<div data-col="result"{% if not is_subentry %} data-order="{% if evaluation.is_single_result %}{{ evaluation.single_result_rating_result.average }}{% else %}{{ evaluation.avg_grade|default:7 }}{% endif %}"{% endif %}> | ||
{% if not evaluation.can_staff_see_average_grade %} | ||
<div class="d-flex" data-bs-toggle="tooltip" data-bs-placement="left" title="{% trans 'Evaluation result is not yet available.' %}"> | ||
{% include "distribution_with_grade_disabled.html" with icon="fas fa-hourglass" %} | ||
</div> | ||
{% else %} | ||
{% include 'evaluation_result_widget.html' with course_or_evaluation=evaluation %} | ||
{% endif %} | ||
</div> | ||
</{% if links_to_results_page %}a{% else %}div{% endif %}> | ||
|
||
{% include 'results_index_evaluation_impl.html' %} | ||
{% endcache %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{% load evaluation_filters %} | ||
{% load results_templatetags %} | ||
|
||
<{% if links_to_results_page %}a href="{% url 'results:evaluation_detail' evaluation.course.semester.id evaluation.id %}"{% else %}div{% endif %} | ||
class="results-grid-row {% if not is_subentry %}heading-row{% else %}evaluation-row{% endif %} | ||
{% if links_to_results_page %} hover-row{% endif %} | ||
{% if evaluation.State.IN_EVALUATION <= evaluation.state and evaluation.state < evaluation.State.PUBLISHED %} | ||
preview-row | ||
{% endif %}"> | ||
<div data-col="name"{% if not is_subentry %} data-order="{{ evaluation.course.name|lower }}"{% endif %}> | ||
<div> | ||
{% if is_subentry %} | ||
{% include 'evaluation_badges.html' with mode='subentry' %} | ||
{% else %} | ||
{% include 'evaluation_badges.html' %} | ||
{% endif %} | ||
</div> | ||
<span class="evaluation-name"> | ||
{% if is_subentry %} | ||
{% if evaluation.name %} | ||
{{ evaluation.name }} | ||
{% else %} | ||
{{ evaluation.course.name }} | ||
{% endif %} | ||
{% else %} | ||
{{ evaluation.full_name }} | ||
{% endif %} | ||
{% if evaluation.is_single_result %} ({{ evaluation.vote_start_datetime|date }}){% endif %} | ||
{% if evaluation.state == evaluation.State.IN_EVALUATION %} | ||
<span data-bs-toggle="tooltip" data-bs-placement="top" class="fas fa-play icon-gray" title="{% trans 'This evaluation is still running' %}"></span> | ||
{% elif evaluation.state == evaluation.State.EVALUATED %} | ||
<span data-bs-toggle="tooltip" data-bs-placement="top" class="fas fa-chart-simple icon-yellow" title="{% trans 'Results not yet published' %}"></span> | ||
{% elif evaluation.state == evaluation.State.REVIEWED %} | ||
{% if evaluation.is_single_result or evaluation.grading_process_is_finished %} | ||
<span data-bs-toggle="tooltip" data-bs-placement="top" class="fas fa-chart-simple icon-red" title="{% trans 'Results not yet published although grading process is finished' %}"></span> | ||
{% else %} | ||
<span data-bs-toggle="tooltip" data-bs-placement="top" class="fas fa-chart-simple icon-yellow" title="{% trans 'Results not yet published' %}"></span> | ||
{% endif %} | ||
{% endif %} | ||
</span> | ||
</div> | ||
{% if not is_subentry %} | ||
<div data-col="semester" data-order="{{ evaluation.course.semester.id }}" class="text-center semester-short-name"> | ||
{{ evaluation.course.semester.short_name }} | ||
</div> | ||
{% endif %} | ||
{% if not is_subentry %} | ||
<div data-col="responsible" data-order="{{ evaluation.course.responsibles.first.last_name|lower }}"> | ||
{{ evaluation.course.responsibles_names }} | ||
</div> | ||
{% endif %} | ||
{% if evaluation.is_single_result %} | ||
<div data-col="participants" class="text-center"><span class="fas fa-user"></span> {{ evaluation.single_result_rating_result.count_sum }}</div> | ||
{% else %} | ||
{% with num_participants=evaluation.num_participants num_voters=evaluation.num_voters %} | ||
<div data-col="participants">{% include 'progress_bar.html' with done=num_voters total=num_participants %}</div> | ||
{% endwith %} | ||
{% endif %} | ||
|
||
<div data-col="result"{% if not is_subentry %} data-order="{% if evaluation.is_single_result %}{{ evaluation.single_result_rating_result.average }}{% else %}{{ evaluation.avg_grade|default:7 }}{% endif %}"{% endif %}> | ||
{% if not evaluation.can_staff_see_average_grade %} | ||
<div class="d-flex" data-bs-toggle="tooltip" data-bs-placement="left" title="{% trans 'Evaluation result is not yet available.' %}"> | ||
{% include "distribution_with_grade_disabled.html" with icon="fas fa-hourglass" %} | ||
</div> | ||
{% else %} | ||
{% include 'evaluation_result_widget.html' with course_or_evaluation=evaluation %} | ||
{% endif %} | ||
</div> | ||
</{% if links_to_results_page %}a{% else %}div{% endif %}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters