fix: don't show past classes

This commit is contained in:
Jannat Patel
2023-03-13 18:03:03 +05:30
parent 0593a9fb30
commit d96e3f4f9f
3 changed files with 8 additions and 6 deletions

View File

@@ -2013,6 +2013,6 @@ select {
visibility: visible;
}
.add-students .text-primary.link-option {
visibility: hidden;
.add-students ul li:nth-last-child(-n+2) {
display: none;
}

View File

@@ -245,13 +245,13 @@
<div class="live-class-panel">
{% if class.owner == frappe.session.user %}
<a class="btn btn-secondary btn-sm mr-2" href="{{ class.start_url }}">
<a class="btn btn-secondary btn-sm mr-2" target="_blank" href="{{ class.start_url }}">
{{ _("Start") }}
</a>
{% endif %}
{% if is_student %}
<a class="btn btn-secondary btn-sm mt-auto" href="{{ class.join_url }}">
<a class="btn btn-secondary btn-sm mt-auto" target="_blank" href="{{ class.join_url }}">
{{ _("Join Class") }}
</a>
{% endif %}

View File

@@ -1,10 +1,12 @@
import frappe
from frappe import _
from frappe.utils import getdate
def get_context(context):
context.no_cache = 1
context.classes = frappe.get_all(
"LMS Class", fields=["name", "title", "start_date", "end_date"]
"LMS Class", {
"end_date": [">=", getdate()]
}, ["name", "title", "start_date", "end_date"]
)