feat: #28 info page, #27 discussion page initial structure, add batch webform change

This commit is contained in:
pateljannat
2021-04-27 10:33:49 +05:30
parent 44dc42d7dd
commit 424967b03e
18 changed files with 372 additions and 185 deletions

View File

@@ -1,5 +1,5 @@
import frappe
from community.www.courses.utils import redirect_if_not_a_member, get_batch, get_member_with_name, get_course
from community.www.courses.utils import redirect_if_not_a_member, get_batch, get_member_with_name, get_course, get_batch_members
def get_context(context):
context.no_cache = 1
@@ -8,16 +8,5 @@ def get_context(context):
context.batch_code = frappe.form_dict["batch"]
redirect_if_not_a_member(context.course_slug, context.batch_code)
context.batch = get_batch(context.batch_code)
context.members = get_members(context.batch)
context.member_count = len(context.members)
def get_members(batch):
members = []
memberships = frappe.get_all("LMS Batch Membership", {"batch": batch}, ["member", "member_type"])
for membership in memberships:
member = get_member_with_name(membership.member)
if membership.member_type == "Mentor":
member.is_mentor = True
members.append(member)
return members
context.members = get_batch_members(context.batch.name)
context.member_count = len(context.members)