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

#854 flatten items from multiple array and merge into one single array #855

Merged
merged 1 commit into from
Oct 26, 2022
Merged

Conversation

zqian
Copy link
Contributor

@zqian zqian commented Oct 24, 2022

Addressing #854

The paged Canvas terms API call returns multiple arrays.

This fix is to flatten the arrays and merge all items from all arrays. Multiple arrays are returned because UM has 101 academic terms returns, so that becomes two arrays since the default array size is 100 in Canvas api calls.

@jonespm
Copy link
Contributor

jonespm commented Oct 24, 2022

This problem appeared to only be an issue when terms in the LMS were over 100 total. The perPage on the apiGet in CanvasAPI is set to 100 by default, so the bug was that it would retrieve 100 and on the then when it got over 100 and retrieved the second page it wouldn't work because of how terms was nested in the json enrollment_terms field.

@bagofarms bagofarms self-requested a review October 26, 2022 20:40
@zqian zqian changed the title issue_854 flatten items from multiple array and merge into one single array #854 flatten items from multiple array and merge into one single array Oct 26, 2022
Copy link
Member

@bagofarms bagofarms left a comment

Choose a reason for hiding this comment

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

Tested and works fine in my instance. Thank you for the contribution!

@bagofarms bagofarms merged commit e912ec0 into ucfopen:dev/v3-3-1 Oct 26, 2022
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.

3 participants