diff --git a/lms/lms/doctype/cohort/cohort.json b/lms/lms/doctype/cohort/cohort.json index 2efa1428..33b33549 100644 --- a/lms/lms/doctype/cohort/cohort.json +++ b/lms/lms/doctype/cohort/cohort.json @@ -61,6 +61,7 @@ "fieldtype": "Data", "in_list_view": 1, "label": "Slug", + "reqd": 1, "unique": 1 }, { @@ -105,7 +106,7 @@ "link_fieldname": "cohort" } ], - "modified": "2021-12-16 14:44:25.406301", + "modified": "2022-10-13 15:46:32.322926", "modified_by": "Administrator", "module": "LMS", "name": "Cohort", @@ -127,5 +128,6 @@ ], "sort_field": "modified", "sort_order": "DESC", + "states": [], "track_changes": 1 } \ No newline at end of file diff --git a/lms/lms/doctype/lms_course/lms_course.py b/lms/lms/doctype/lms_course/lms_course.py index e5080bcd..44de5bae 100644 --- a/lms/lms/doctype/lms_course/lms_course.py +++ b/lms/lms/doctype/lms_course/lms_course.py @@ -137,7 +137,7 @@ class LMSCourse(Document): def get_cohorts(self): - return frappe.get_all("Cohort", {"course": self.name}, order_by="creation") + return frappe.get_all("Cohort", {"course": self.name}, ["name", "slug"], order_by="creation") def get_cohort(self, cohort_slug): diff --git a/lms/www/cohorts/cohort.html b/lms/www/cohorts/cohort.html index 007e5d70..678e806e 100644 --- a/lms/www/cohorts/cohort.html +++ b/lms/www/cohorts/cohort.html @@ -2,22 +2,24 @@ {% block title %}Manage {{ course.title }}{% endblock %} {% block page_content %} -
{% set stats = cohort.get_stats() %} - {{ stats.subgroups }} Subgroups - | {{ stats.mentors }} Mentors - | {{ stats.students }} students - | {{ stats.join_requests }} join requests + {{ stats.subgroups }} {{ _("Subgroups")}} + | {{ stats.mentors }} {{ _("Mentors") }} + | {{ stats.students }} {{ _("Students") }} + | {{ stats.join_requests }} {{ _("Join Requests") }}
{% if is_mentor %} -You are a mentor of {{sg.title}} subgroup.
- +{% set sg = mentor.get_subgroup() %} + {% endif %} diff --git a/lms/www/cohorts/index.py b/lms/www/cohorts/index.py index 2d1f648b..54efbf83 100644 --- a/lms/www/cohorts/index.py +++ b/lms/www/cohorts/index.py @@ -1,5 +1,6 @@ import frappe from .utils import get_course, add_nav +from frappe.utils import get_url def get_context(context): context.no_cache = 1 @@ -14,7 +15,7 @@ def get_context(context): context.cohorts = get_cohorts(context.course) if len(context.cohorts) == 1: - frappe.local.flags.redirect_location = context.cohorts[0].get_url() + frappe.local.flags.redirect_location = f"{get_url()}/courses/{context.course.name}/cohorts/{context.cohorts[0].slug}" raise frappe.Redirect add_nav(context, "All Courses", "/courses") diff --git a/lms/www/cohorts/subgroup.html b/lms/www/cohorts/subgroup.html index 2b61c052..37ec133a 100644 --- a/lms/www/cohorts/subgroup.html +++ b/lms/www/cohorts/subgroup.html @@ -2,10 +2,9 @@ {% block title %} Subgroup {{subgroup.title}} - {{ course.title }} {% endblock %} {% block page_content %} -