fix: get_doc references
This commit is contained in:
@@ -49,11 +49,11 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if membership %}
|
||||
{% set lesson_index = course.get_lesson_index(membership.current_lesson) if membership and
|
||||
{% set lesson_index = get_lesson_index(membership.current_lesson) if membership and
|
||||
membership.current_lesson
|
||||
else '1.1' %}
|
||||
<a class="button wide-button is-primary" id="continue-learning"
|
||||
href="{{ course.get_learn_url(lesson_index) }}{{ course.query_parameter }}">
|
||||
href="{{ get_lesson_url(course.name, lesson_index) }}{{ course.query_parameter }}">
|
||||
Continue Learning <img class="ml-2" src="/assets/school/icons/white-arrow.svg" />
|
||||
</a>
|
||||
{% endif %}
|
||||
@@ -70,7 +70,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if course.is_cohort_staff(frappe.session.user) %}
|
||||
{% if is_cohort_staff(course.name, frappe.session.user) %}
|
||||
<a class="button wide-button is-secondary"
|
||||
href="/courses/{{course.name}}/manage"
|
||||
style="color: inherit;">
|
||||
@@ -129,14 +129,14 @@
|
||||
<div class="course-home-headings">
|
||||
Creator
|
||||
</div>
|
||||
{% for instructor in course.get_instructors() %}
|
||||
{% for instructor in get_instructors(course.name) %}
|
||||
{{ widgets.MemberCard(member=instructor, show_course_count=True, avatar_class="avatar-large") }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro Progress(course) %}
|
||||
{% set certificate = course.is_certified() %}
|
||||
{% set certificate = is_certified(course.name) %}
|
||||
{% set progress = frappe.utils.cint(membership.progress) %}
|
||||
{% if progress %}
|
||||
<div class="course-progress-section">
|
||||
@@ -186,17 +186,17 @@
|
||||
{% endmacro %}
|
||||
|
||||
{% macro Overview(course) %}
|
||||
{% set avg_rating = course.get_average_rating() %}
|
||||
{% if course.get_students() | length or avg_rating %}
|
||||
{% set avg_rating = get_average_rating(course.name) %}
|
||||
{% if get_students(course.name) | length or avg_rating %}
|
||||
<div class="course-overview-section">
|
||||
<div class="course-home-headings">
|
||||
Overview
|
||||
</div>
|
||||
<div class="common-card-style overview-card small-title">
|
||||
{% if course.get_students() | length %}
|
||||
{% if get_students(course.name) | length %}
|
||||
<div class="overview-item">
|
||||
<img class="icon-background mr-1" src="/assets/school/icons/user.svg" />
|
||||
{{ course.get_students() | length }} Enrolled
|
||||
{{ get_students(course.name) | length }} Enrolled
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if avg_rating %}
|
||||
@@ -213,13 +213,13 @@
|
||||
<!-- Mentors -->
|
||||
|
||||
{% macro Mentors(course) %}
|
||||
{% if course.get_mentors() | length %}
|
||||
{% if get_mentors(course.name) | length %}
|
||||
<div class="course-home-mentors">
|
||||
<div class="course-home-headings">
|
||||
Mentors
|
||||
</div>
|
||||
<div class="member-parent">
|
||||
{% for mentor in course.get_mentors() %}
|
||||
{% for mentor in get_mentors(course.name) %}
|
||||
{{ widgets.MemberCard(member=mentor, show_course_count=False) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import frappe
|
||||
from school.lms.doctype.lms_settings.lms_settings import check_profile_restriction
|
||||
from school.www.utils import get_membership
|
||||
|
||||
def get_context(context):
|
||||
context.no_cache = 1
|
||||
@@ -16,7 +17,7 @@ def get_context(context):
|
||||
raise frappe.Redirect
|
||||
|
||||
context.course = course
|
||||
membership = course.get_membership(frappe.session.user)
|
||||
membership = get_membership(course.name, frappe.session.user)
|
||||
context.course.query_parameter = "?batch=" + membership.batch if membership and membership.batch else ""
|
||||
context.membership = membership
|
||||
if context.course.upcoming:
|
||||
|
||||
@@ -15,7 +15,7 @@ def get_context(context):
|
||||
def get_courses():
|
||||
courses = frappe.get_all("LMS Course",
|
||||
filters={"is_published": True},
|
||||
fields=["name", "upcoming", "title", "image"])
|
||||
fields=["name", "upcoming", "title", "image", "enable_certification"])
|
||||
|
||||
live_courses, upcoming_courses = [], []
|
||||
for course in courses:
|
||||
|
||||
Reference in New Issue
Block a user