Merge branch 'main' into community-member-to-user-refactor

This commit is contained in:
Anand Chitipothu
2021-05-24 11:39:20 +05:30
committed by GitHub
4 changed files with 57 additions and 22 deletions

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -6,11 +6,13 @@
"engine": "InnoDB",
"field_order": [
"batch",
"role",
"column_break_3",
"member",
"member_name",
"member_type"
"member_email",
"column_break_3",
"course",
"member_type",
"role"
],
"fields": [
{
@@ -30,6 +32,7 @@
"options": "User"
},
{
"default": "Student",
"fieldname": "member_type",
"fieldtype": "Select",
"in_list_view": 1,
@@ -37,6 +40,7 @@
"options": "\nStudent\nMentor\nStaff"
},
{
"default": "Member",
"fieldname": "role",
"fieldtype": "Select",
"in_standard_filter": 1,
@@ -54,11 +58,28 @@
{
"fieldname": "column_break_3",
"fieldtype": "Column Break"
},
{
"fetch_from": "member.email",
"fieldname": "member_email",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Member Email",
"read_only": 1,
"read_only_depends_on": "member.email"
},
{
"fetch_from": "batch.course",
"fieldname": "course",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Course",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2021-05-21 11:48:05.363738",
"modified": "2021-05-24 09:32:04.128620",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Batch Membership",

View File

@@ -92,27 +92,17 @@ class LMSCourse(Document):
Returns None if the student is not part of any batch.
"""
if not email:
return False
result = frappe.db.get_all(
"LMS Batch Membership",
filters={
"member": email,
"member_type": "Student",
},
fields=['batch']
)
batches = [row['batch'] for row in result]
return
# filter the batches that are for this course
result = frappe.db.get_all(
"LMS Batch",
batch_name = frappe.get_value(
doctype="LMS Batch Membership",
filters={
"course": self.name,
"name": ["IN", batches]
})
batches = [row['name'] for row in result]
if batches:
return frappe.get_doc("LMS Batch", batches[0])
"member_type": "Student",
"member": email
},
fieldname="batch")
return batch_name and frappe.get_doc("LMS Batch", batch_name)
def get_instructor(self):
return frappe.get_doc("User", self.owner)

View File

@@ -6,6 +6,10 @@
</div>
</div>
<div class="course-footer">
{% set batch = course.get_student_batch(frappe.session.user) %}
{% if batch %}
<a class="btn btn-secondary pull-right" href="/courses/{{course.name}}/{{batch.name}}/learn">Resume Course</a>
{% endif %}
<div class="course-author">
{% with author = course.get_instructor() %}
{{ widgets.Avatar(member=author, avatar_class="avatar-medium") }} <a href="/{{author.username}}">{{ author.full_name }}</a>