Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: course when instructor is not set #572

Merged
merged 2 commits into from
Aug 25, 2023

Conversation

tahir-zaqout
Copy link

@tahir-zaqout tahir-zaqout commented Jul 27, 2023

instructors = frappe.get_all(
"Course Instructor", {"parent": course}, ["instructor"], order_by="idx"
)
it return like
[
{"instructor": "user1"},
{"instructor": "user2"}
]
and the
if not instructors:
instructors = frappe.db.get_value("LMS Course", course, "owner").split(" ")

return ["user1", "user2"]

and it make error if get all return []
because instructor.instructor at https://github.com/frappe/lms/blob/main/lms/lms/utils.py#L167

@ahmadRagheb
Copy link
Contributor

Great Job @tahir-zaqout

@tahir-zaqout
Copy link
Author

@pateljannat

lms/lms/utils.py Outdated
@@ -156,15 +156,15 @@ def get_tags(course):
def get_instructors(course):
instructor_details = []
instructors = frappe.get_all(
"Course Instructor", {"parent": course}, ["instructor"], order_by="idx"
"Course Instructor", {"parent": course}, ["instructor"], order_by="idx", pluck="instructor"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No of pluck here. Below change would do

@niraj2477
Copy link
Contributor

This PR will fix : #587

lms/lms/utils.py Outdated Show resolved Hide resolved
@pateljannat pateljannat changed the title fix: get_instructors function fix: course when instructor is not set Aug 25, 2023
@cypress
Copy link

cypress bot commented Aug 25, 2023

Passing run #204 ↗︎

0 1 0 0 Flakiness 0

Details:

Merge 86434ea into 7f67c6c...
Project: lms Commit: 302489addf ℹ️
Status: Passed Duration: 01:06 💡
Started: Aug 25, 2023 12:20 PM Ended: Aug 25, 2023 12:21 PM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@pateljannat pateljannat merged commit 1676329 into frappe:main Aug 25, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants