-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1100 from pateljannat/issues-47
fix: misc issues
- Loading branch information
Showing
12 changed files
with
181 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
# Copyright (c) 2021, FOSS United and contributors | ||
# For license information, please see license.txt | ||
|
||
# import frappe | ||
import frappe | ||
from frappe.model.document import Document | ||
from frappe.utils.telemetry import capture | ||
from lms.lms.utils import get_course_progress | ||
from lms.lms.api import update_course_statistics | ||
|
||
|
||
class CourseChapter(Document): | ||
pass | ||
def on_update(self): | ||
self.recalculate_course_progress() | ||
update_course_statistics() | ||
|
||
def recalculate_course_progress(self): | ||
previous_lessons = ( | ||
self.get_doc_before_save() and self.get_doc_before_save().as_dict().lessons | ||
) | ||
current_lessons = self.lessons | ||
|
||
if previous_lessons and previous_lessons != current_lessons: | ||
enrolled_members = frappe.get_all( | ||
"LMS Enrollment", {"course": self.course}, ["member", "name"] | ||
) | ||
for enrollment in enrolled_members: | ||
new_progress = get_course_progress(self.course, enrollment.member) | ||
frappe.db.set_value("LMS Enrollment", enrollment.name, "progress", new_progress) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import frappe | ||
from lms.lms.api import give_dicussions_permission | ||
|
||
|
||
def execute(): | ||
give_dicussions_permission() |