diff --git a/lms/lms/doctype/lms_course/lms_course.py b/lms/lms/doctype/lms_course/lms_course.py
index 44de5bae..3b4e7e41 100644
--- a/lms/lms/doctype/lms_course/lms_course.py
+++ b/lms/lms/doctype/lms_course/lms_course.py
@@ -137,7 +137,10 @@ class LMSCourse(Document):
def get_cohorts(self):
- return frappe.get_all("Cohort", {"course": self.name}, ["name", "slug"], order_by="creation")
+ return frappe.get_all("Cohort",
+ {"course": self.name},
+ ["name", "slug", "title", "begin_date", "end_date"],
+ order_by="creation")
def get_cohort(self, cohort_slug):
diff --git a/lms/www/cohorts/cohort.html b/lms/www/cohorts/cohort.html
index e1f54b5d..83e2f227 100644
--- a/lms/www/cohorts/cohort.html
+++ b/lms/www/cohorts/cohort.html
@@ -1,5 +1,7 @@
{% extends "www/cohorts/base.html" %}
-{% block title %}Manage {{ course.title }}{% endblock %}
+{% block title %}
+{{ _("Manage") }} {{ course.title }}
+{% endblock %}
{% block page_content %}
@@ -7,12 +9,10 @@
- {% set stats = cohort.get_stats() %}
-
- {{ stats.subgroups }} {{ _("Subgroups")}}
- | {{ stats.mentors }} {{ _("Mentors") }}
- | {{ stats.students }} {{ _("Students") }}
- | {{ stats.join_requests }} {{ _("Join Requests") }}
+ {{ frappe.db.count("Cohort Subgroup", {"cohort": cohort.name}) }} {{ _("Subgroups") }}
+ | {{ frappe.db.count("Cohort Mentor", {"cohort": cohort.name}) }} {{ _("Mentors") }}
+ | {{ frappe.db.count("LMS Batch Membership", {"cohort": cohort.name}) }} {{ _("Students") }}
+ | {{ frappe.db.count("Cohort Join Request", {"cohort": cohort.name}) }} {{ _("Join Requests") }}
{% if is_mentor %}
@@ -25,19 +25,19 @@
{% endif %}
- {% set num_subgroups = cohort.get_subgroups() | length %}
- {{ render_navitem("Subgroups", "", page=page, count=num_subgroups) }}
- {% for p in cohort.get_pages(scope="Cohort") %}
- {{ render_navitem(p.title, p.slug, page=page) }}
- {% endfor %}
+ {% set num_subgroups = cohort.get_subgroups() | length %}
+ {{ render_navitem("Subgroups", "", page=page, count=num_subgroups) }}
+ {% for p in cohort.get_pages(scope="Cohort") %}
+ {{ render_navitem(p.title, p.slug, page=page) }}
+ {% endfor %}
-{% if not page %}
- {{ render_subgroups() }}
-{% else %}
- {{ render_page(page) }}
-{% endif %}
+ {% if not page %}
+ {{ render_subgroups() }}
+ {% else %}
+ {{ render_page(page) }}
+ {% endif %}
{% endblock %}
@@ -55,7 +55,7 @@
{{ sg.num_mentors }} {{ _("Mentors") }}
|
- {{sg.num_students}} {{ _(Students) }}
+ {{sg.num_students}} {{ _("Students") }}
|
{{sg.num_join_requests}} {{ _("Join Requests") }}
diff --git a/lms/www/cohorts/index.html b/lms/www/cohorts/index.html
index 9c0b9fab..db0add8d 100644
--- a/lms/www/cohorts/index.html
+++ b/lms/www/cohorts/index.html
@@ -1,38 +1,53 @@
{% extends "www/cohorts/base.html" %}
-{% block title %}Manage {{ course.title }}{% endblock %}
+{% block title %}
+ _("Manage") {{ course.title }}
+{% endblock %}
{% block page_content %}
- {% if cohorts %}
- {{ _("Cohorts") }}
-
- {% for cohort in cohorts %}
-
- {{ render_cohort(course, cohort) }}
-
- {% endfor %}
-
- {% else %}
- {{ _("Permission Denied") }}
- {{ _("You don't have permission to manage this course.") }}
- {% endif %}
+ {% if cohorts %}
+
+ {{ _("Cohorts") }}
+
+
+ {% for cohort in cohorts %}
+
+ {{ render_cohort(course, cohort) }}
+
+ {% endfor %}
+
+ {% else %}
+
+ {{ _("Permission Denied") }}
+
+
+ {{ _("You don't have permission to manage this course.") }}
+
+ {% endif %}
{% endblock %}
{% macro render_cohort(course, cohort) %}
-
-
-
{{cohort.title}}
-
{{cohort.begin_date}} - {{cohort.end_date}}
-
- {% set stats = cohort.get_stats() %}
+
+
+
+ {{ cohort.title }}
+
- {{ stats.subgroups }} Subgroups
- | {{ stats.mentors }} Mentors
- | {{ stats.students }} students
- | {{ stats.join_requests }} join requests
-
+ {% if cohort.begin_date %}
+
+ {{ frappe.utils.format_date(cohort.begin_date, "medium") }} - {{ frappe.utils.format_date(cohort.end_date, "medium") }}
+
+ {% endif %}
-
{{ _("Manage") }}
-
+
+ {{ frappe.db.count("Cohort Subgroup", {"cohort": cohort.name}) }} {{ _("Subgroups") }}
+ | {{ frappe.db.count("Cohort Mentor", {"cohort": cohort.name}) }} {{ _("Mentors") }}
+ | {{ frappe.db.count("LMS Batch Membership", {"cohort": cohort.name}) }} {{ _("Students") }}
+ | {{ frappe.db.count("Cohort Join Request", {"cohort": cohort.name}) }} {{ _("Join Requests") }}
+
+
+
+
+
{% endmacro %}
diff --git a/lms/www/courses/course.html b/lms/www/courses/course.html
index 40a7a5b2..8f600061 100644
--- a/lms/www/courses/course.html
+++ b/lms/www/courses/course.html
@@ -292,12 +292,7 @@
{% set lesson_index = get_lesson_index(membership.current_lesson) if membership and
membership.current_lesson else "1.1" if first_lesson_exists(course.name) else None %}
- {% if show_start_learing_cta(course, membership) %}
-
- {{ _("Start Learning") }}
-
-
- {% elif is_instructor(course.name) and not course.published and course.status != "Under Review" %}
+ {% if is_instructor(course.name) and not course.published and course.status != "Under Review" %}
{{ _("Submit for Review") }}
@@ -323,6 +318,11 @@
href="{{ get_lesson_url(course.name, lesson_index) }}{{ course.query_parameter }}">
{{ _("Continue Learning") }}
+
+ {% elif show_start_learing_cta(course, membership) %}
+
+ {{ _("Start Learning") }}
+
{% endif %}
{% set progress = frappe.utils.cint(membership.progress) %}