fix: removed unused functions

This commit is contained in:
Jannat Patel
2022-09-27 18:21:57 +05:30
parent a291d73828
commit cf8549bb28

View File

@@ -22,58 +22,3 @@ def get_notifications():
notification.url = "/courses/{0}/learn/{1}".format(course, get_lesson_index(notification.document_name))
return notifications
def get_notifications_old():
notifications = []
notifications += get_notifications_from_lessons_created()
notifications += get_notifications_from_topics_created()
if len(notifications):
notifications = sorted(notifications, key=lambda t: datetime.strptime(frappe.utils.format_datetime(t.creation, "dd-mm-yyyy HH:mm:ss"),"%d/%m/%Y %H:%M:%S"))
return notifications
def get_notifications_from_lessons_created():
lessons = frappe.get_all("Course Lesson", {
"owner": frappe.session.user
}, ["name"])
for lesson in lessons:
topics = frappe.get_all("Discussion Topic", {
"reference_doctype": "Course Lesson",
"reference_docname": lesson.name
}, ["name"])
return get_notifications_from_replies(topics)
def get_notifications_from_topics_created():
topics = frappe.get_all("Discussion Topic", {
"owner": frappe.session.user
}, ["name"])
return get_notifications_from_replies(topics)
def get_notifications_from_replies(topics):
notifications = []
for topic in topics:
replies = frappe.get_all("Discussion Reply", {
"topic": topic.name
}, ["reply", "owner", "creation"])
for reply in replies:
notification = frappe._dict()
notification["message"] = reply.reply
notification["user"] = reply.owner
notification["creation"] = reply.creation
notifications.append(notification)
return notifications