perf: course cards get all memberships at once
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import frappe
|
||||
from lms.lms.doctype.lms_settings.lms_settings import check_profile_restriction
|
||||
from lms.lms.utils import get_membership, has_course_moderator_role, is_instructor, is_certified, get_evaluation_details, redirect_to_courses_list
|
||||
|
||||
def get_context(context):
|
||||
@@ -46,7 +45,6 @@ def set_course_context(context, course_name):
|
||||
membership = get_membership(course.name, frappe.session.user)
|
||||
context.course.query_parameter = "?batch=" + membership.batch if membership and membership.batch else ""
|
||||
context.membership = membership
|
||||
context.restriction = check_profile_restriction()
|
||||
context.show_start_learing_cta = show_start_learing_cta(course, membership, context.restriction)
|
||||
context.certificate = is_certified(course.name)
|
||||
eval_details = get_evaluation_details(course.name)
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
{% extends "templates/base.html" %}
|
||||
{% block title %}{{ 'Courses' }}{% endblock %}
|
||||
|
||||
|
||||
{% block title %}
|
||||
{{ 'Courses' }}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block head_include %}
|
||||
{% include "public/icons/symbol-defs.svg" %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<div class="common-page-style">
|
||||
<div class="container">
|
||||
{% if restriction.restrict %}
|
||||
{% if restriction %}
|
||||
{% set profile_link = "<a href='/edit-profile'> profile </a>" %}
|
||||
<div class="empty-state">
|
||||
<div class="course-home-headings text-center mb-0" style="color: inherit;">
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
from lms.lms.doctype.lms_settings.lms_settings import check_profile_restriction
|
||||
from lms.lms.utils import check_profile_restriction, get_restriction_details
|
||||
|
||||
|
||||
def get_context(context):
|
||||
context.no_cache = 1
|
||||
context.live_courses, context.upcoming_courses = get_courses()
|
||||
context.restriction = check_profile_restriction()
|
||||
|
||||
if context.restriction:
|
||||
context.restriction_details = get_restriction_details()
|
||||
|
||||
context.metatags = {
|
||||
"title": _("All Live Courses"),
|
||||
"image": frappe.db.get_single_value("Website Settings", "banner_image"),
|
||||
@@ -13,6 +18,7 @@ def get_context(context):
|
||||
"keywords": "All Courses, Courses, Learn"
|
||||
}
|
||||
|
||||
|
||||
def get_courses():
|
||||
courses = frappe.get_all("LMS Course",
|
||||
filters={"published": True},
|
||||
|
||||
Reference in New Issue
Block a user