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

refactor: move more functionality to Canvas plugin #387

Merged
merged 5 commits into from
Nov 18, 2024

Conversation

arslanashraf7
Copy link
Contributor

@arslanashraf7 arslanashraf7 commented Oct 29, 2024

What are the relevant tickets?

https://github.com/mitodl/hq/issues/5862

Description (What does it do?)

  • Migrates more code from our custom commit
  • Mostly, It migrates the task filtering part
  • Migrates the course setting part

How can this be tested?

@arslanashraf7 arslanashraf7 force-pushed the arslan/5862-enhance-canvas-plugin branch from 3563b20 to 4e4b32c Compare October 30, 2024 10:57
@arslanashraf7 arslanashraf7 marked this pull request as ready for review November 6, 2024 14:12
@arslanashraf7 arslanashraf7 force-pushed the arslan/5862-enhance-canvas-plugin branch 3 times, most recently from 02a4875 to 4f4bf17 Compare November 14, 2024 12:50
Comment on lines 6 to 9

if course:
return course.other_course_settings.get("canvas_id")
return None

Choose a reason for hiding this comment

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

Suggested change
if course:
return course.other_course_settings.get("canvas_id")
return None
return course.other_course_settings.get("canvas_id") if course else None

**For "Quince" or more recent release of edX platform, you should cherry-pick below commit:**

https://github.com/mitodl/edx-platform/commit/7a2edd5d29ead6845cb33d2001746207cf696383

**For "Nutmeg" or more recent release of edX platform, you should cherry-pick below commit:**

Choose a reason for hiding this comment

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

Suggested change
**For "Nutmeg" or more recent release of edX platform, you should cherry-pick below commit:**
**For "Nutmeg" release of edX platform, you should cherry-pick below commit:**

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These were in incremental order so a person reading from top to bottom would always go from Sumac to downward. When the go there they would see the next release and it's predecessors message. Eventually they will get the right version out of the list.

In any case, we can't specify one release name, it's always going to be a range. I went there and that made things more complex to read than using the same more recent format. If we still need to change, I'd go for a release range and not just one specific release.

The is for all the other comments on things like these below.

Choose a reason for hiding this comment

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

I commented because Nutmeg and prior means Nutmeg, Quince, and Sumac. These releases have specific commits/versions specified, so I think we can mention a single release in this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea was that the person would read from top to bottom. So they will read Sumac message first. I'm changing it into a range in next commit anyway


TBA

**For "Quince" or more recent release of edX platform, you should cherry-pick below commit:**

Choose a reason for hiding this comment

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

Suggested change
**For "Quince" or more recent release of edX platform, you should cherry-pick below commit:**
**For "Quince" release of edX platform, you should cherry-pick below commit:**


Use ``0.3.0`` or a above version of this plugin


**For "Nutmeg" or more recent release of edX platform**

Choose a reason for hiding this comment

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

Suggested change
**For "Nutmeg" or more recent release of edX platform**
**For "Nutmeg" release of edX platform**


Use ``0.4.0`` or a above version of this plugin

**For "Quince" or more recent release of edX platform**

Choose a reason for hiding this comment

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

Suggested change
**For "Quince" or more recent release of edX platform**
**For "Quince" release of edX platform**

client = CanvasClient(canvas_course_id=course.canvas_course_id)
if not course.canvas_course_id:
canvas_course_id = get_canvas_course_id(course)
client = CanvasClient(canvas_course_id=canvas_course_id)

Choose a reason for hiding this comment

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

We are initializing client before checking canvas_course_id.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Been there for a long time becasue and it didn't break because the canvas course Id check below that would return anyway, I'll move the client initialization a couple of lines below.

Choose a reason for hiding this comment

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

Yeah, I checked that. I just mentioned it because of the validation. We can either initialize it after the validation or remove the validation if it is not needed.

client = CanvasClient(canvas_course_id=course.canvas_course_id)
if not course.canvas_course_id:
canvas_course_id = get_canvas_course_id(course)
client = CanvasClient(canvas_course_id=canvas_course_id)

Choose a reason for hiding this comment

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

Same, Initialization before validation

Copy link

@asadali145 asadali145 left a comment

Choose a reason for hiding this comment

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

LGTM!

@arslanashraf7 arslanashraf7 force-pushed the arslan/5862-enhance-canvas-plugin branch 2 times, most recently from 91dc185 to 34efad7 Compare November 15, 2024 10:56
@arslanashraf7
Copy link
Contributor Author

arslanashraf7 commented Nov 15, 2024

I've incorporated all the changes in 34efad7. @asadali145 Could you take a look?

*Edit: I have added additional validations where applicable.

Comment on lines 209 to 210
canvas_course_id = get_canvas_course_id(course)
if not course:
raise Exception(COURSE_KEY_ID_EMPTY) # noqa: TRY002

Choose a reason for hiding this comment

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

We are validating course values after getting canvas id.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in e028503

@arslanashraf7 arslanashraf7 force-pushed the arslan/5862-enhance-canvas-plugin branch from e028503 to 88f1500 Compare November 18, 2024 10:35
@arslanashraf7 arslanashraf7 merged commit 5cdd913 into main Nov 18, 2024
5 of 11 checks passed
@arslanashraf7 arslanashraf7 deleted the arslan/5862-enhance-canvas-plugin branch November 18, 2024 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants