fix: conflicts
This commit is contained in:
0
school/lms/doctype/course_instructor/__init__.py
Normal file
0
school/lms/doctype/course_instructor/__init__.py
Normal file
32
school/lms/doctype/course_instructor/course_instructor.json
Normal file
32
school/lms/doctype/course_instructor/course_instructor.json
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"actions": [],
|
||||||
|
"allow_rename": 1,
|
||||||
|
"creation": "2022-02-07 11:39:59.998762",
|
||||||
|
"doctype": "DocType",
|
||||||
|
"editable_grid": 1,
|
||||||
|
"engine": "InnoDB",
|
||||||
|
"field_order": [
|
||||||
|
"instructor"
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldname": "instructor",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"in_list_view": 1,
|
||||||
|
"label": "Instructor",
|
||||||
|
"options": "User"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"index_web_pages_for_search": 1,
|
||||||
|
"istable": 1,
|
||||||
|
"links": [],
|
||||||
|
"modified": "2022-02-07 11:41:42.943250",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "LMS",
|
||||||
|
"name": "Course Instructor",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"permissions": [],
|
||||||
|
"sort_field": "modified",
|
||||||
|
"sort_order": "DESC",
|
||||||
|
"states": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Copyright (c) 2022, Frappe and contributors
|
||||||
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
# import frappe
|
||||||
|
from frappe.model.document import Document
|
||||||
|
|
||||||
|
class CourseInstructor(Document):
|
||||||
|
pass
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
"video_link",
|
"video_link",
|
||||||
"image",
|
"image",
|
||||||
"column_break_3",
|
"column_break_3",
|
||||||
"instructor",
|
"instructors",
|
||||||
"tags",
|
"tags",
|
||||||
"section_break_7",
|
"section_break_7",
|
||||||
"is_published",
|
"is_published",
|
||||||
@@ -104,12 +104,11 @@
|
|||||||
"options": "Chapter Reference"
|
"options": "Chapter Reference"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "instructor",
|
"fieldname": "instructors",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Table MultiSelect",
|
||||||
"in_list_view": 1,
|
|
||||||
"in_standard_filter": 1,
|
"in_standard_filter": 1,
|
||||||
"label": "Instructor",
|
"label": "Instructors",
|
||||||
"options": "User"
|
"options": "Course Instructor"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "section_break_7",
|
"fieldname": "section_break_7",
|
||||||
@@ -168,7 +167,7 @@
|
|||||||
"link_fieldname": "course"
|
"link_fieldname": "course"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2021-09-30 10:36:48.759995",
|
"modified": "2022-02-07 11:41:39.735325",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Course",
|
"name": "LMS Course",
|
||||||
@@ -190,6 +189,7 @@
|
|||||||
"search_fields": "title",
|
"search_fields": "title",
|
||||||
"sort_field": "creation",
|
"sort_field": "creation",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
|
"states": [],
|
||||||
"title_field": "title",
|
"title_field": "title",
|
||||||
"track_changes": 1
|
"track_changes": 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,8 +142,6 @@ class LMSCourse(Document):
|
|||||||
fieldname="batch")
|
fieldname="batch")
|
||||||
return batch_name and frappe.get_doc("LMS Batch", batch_name)
|
return batch_name and frappe.get_doc("LMS Batch", batch_name)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_slugified_chapter_title(self, chapter):
|
def get_slugified_chapter_title(self, chapter):
|
||||||
return slugify(chapter)
|
return slugify(chapter)
|
||||||
|
|
||||||
|
|||||||
@@ -39,10 +39,11 @@
|
|||||||
{{ widgets.Avatar(member=course.get_instructor(), avatar_class="avatar-small") }}
|
{{ widgets.Avatar(member=course.get_instructor(), avatar_class="avatar-small") }}
|
||||||
<a class="button-links" href="{{ get_profile_url(course.get_instructor().username) }}">
|
<a class="button-links" href="{{ get_profile_url(course.get_instructor().username) }}">
|
||||||
<span class="course-instructor">
|
<span class="course-instructor">
|
||||||
{{ course.get_instructor().full_name }}
|
{{ instructor.full_name }}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
{% endfor %}
|
||||||
<span class="course-student-count">
|
<span class="course-student-count">
|
||||||
{% if course.get_students() | length %}
|
{% if course.get_students() | length %}
|
||||||
<span class="vertically-center mr-4">
|
<span class="vertically-center mr-4">
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
<div class="course-teaser">
|
|
||||||
<div class="course-body">
|
|
||||||
<h3 class="course-title"><a href="/courses/{{ course.name }}">{{ course.title }}</a></h3>
|
|
||||||
<div class="course-intro">
|
|
||||||
{{ course.short_introduction or "" }}
|
|
||||||
</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="{{get_profile_url(author.username)}}">{{ author.full_name }}</a>
|
|
||||||
{% endwith %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -21,3 +21,4 @@ execute:frappe.delete_doc("DocType", "LMS Topic") #06-10-2021
|
|||||||
school.patches.v0_0.add_progress_to_membership #20-10-2021
|
school.patches.v0_0.add_progress_to_membership #20-10-2021
|
||||||
execute:frappe.delete_doc("Workspace", "LMS", ignore_missing=True, force=True) #24-10-2021
|
execute:frappe.delete_doc("Workspace", "LMS", ignore_missing=True, force=True) #24-10-2021
|
||||||
execute:frappe.delete_doc("Custom Field", "User-verify_age", ignore_missing=True, force=True)
|
execute:frappe.delete_doc("Custom Field", "User-verify_age", ignore_missing=True, force=True)
|
||||||
|
school.patches.v0_0.multiple_instructors #08-02-2022
|
||||||
|
|||||||
14
school/patches/v0_0/multiple_instructors.py
Normal file
14
school/patches/v0_0/multiple_instructors.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
frappe.reload_doc("lms", "doctype", "lms_course")
|
||||||
|
courses = frappe.get_all("LMS Course", fields=["name", "instructor"])
|
||||||
|
for course in courses:
|
||||||
|
doc = frappe.get_doc({
|
||||||
|
"doctype": "Course Instructor",
|
||||||
|
"parent": course.name,
|
||||||
|
"parentfield": "instructors",
|
||||||
|
"parenttype": "LMS Course",
|
||||||
|
"instructor": course.instructor
|
||||||
|
})
|
||||||
|
doc.save()
|
||||||
@@ -129,7 +129,9 @@
|
|||||||
<div class="course-home-headings">
|
<div class="course-home-headings">
|
||||||
Creator
|
Creator
|
||||||
</div>
|
</div>
|
||||||
{{ widgets.MemberCard(member=course.get_instructor(), show_course_count=True, avatar_class="avatar-large") }}
|
{% for instructor in course.get_instructors() %}
|
||||||
|
{{ widgets.MemberCard(member=instructor, show_course_count=True, avatar_class="avatar-large") }}
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,11 @@ def get_tags(course):
|
|||||||
tags = frappe.db.get_value("LMS Course", course, "tags")
|
tags = frappe.db.get_value("LMS Course", course, "tags")
|
||||||
return tags.split(",") if tags else []
|
return tags.split(",") if tags else []
|
||||||
|
|
||||||
def get_instructor(course):
|
def get_instructors(self):
|
||||||
if self.instructor:
|
instructors = []
|
||||||
return frappe.get_doc("User", self.instructor)
|
if self.instructors:
|
||||||
return frappe.get_doc("User", self.owner)
|
for instructor in self.instructors:
|
||||||
|
instructors.append(frappe.get_doc("User", instructor.instructor))
|
||||||
|
else:
|
||||||
|
instructors.append(frappe.get_doc("User", self.owner))
|
||||||
|
return instructors
|
||||||
|
|||||||
Reference in New Issue
Block a user