Skip to content

Conversation

@ruba0s
Copy link

@ruba0s ruba0s commented Sep 30, 2025

No description provided.

@mikehquan19
Copy link
Contributor

@ruba0s, as for merge conflicts, ideally, you should pull the new changes to your local first, manually resolve those conflicts, and push them back. Resolving shouldn't take very long if those conflicts are not really related to what you are working on.

@ruba0s
Copy link
Author

ruba0s commented Oct 3, 2025

@mikehquan19 Sounds good! Once I'm done with that and want to commit merge, should I choose commit updates to the develop branch or create a new branch and commit updates?

@mikehquan19
Copy link
Contributor

You commit merge to whichever branch you are working on, don’t create a new branch.


// paginate the sections
bson.D{{Key: "$skip", Value: paginateMap["latter_offset"]}},
bson.D{{Key: "$limit", Value: paginateMap["limit"]}},
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe these 3 last stages here are essentially the same (since they all sort and paginate the latter object whether it's course or section), so you could potentially put them after (or before?) conditions.

Other than that, this one should be ready for merging!

Copy link
Contributor

@mikehquan19 mikehquan19 left a comment

Choose a reason for hiding this comment

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

Your changes look almost functional, just a few more changes, and maybe moving the function to end of a file it would be great.

Once you're done, ping me and I will get it merged first thing.

}}},

// keep order deterministic between calls
bson.D{{Key: "$sort", Value: bson.D{{Key: "_id", Value: 1}}}},
Copy link
Contributor

Choose a reason for hiding this comment

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

I think $sort could belong to the pagination stages since they are supposed to be sorted right before we paginate the second time

}}},

// replace the combination of ids and courses with the courses entirely
bson.D{{Key: "$replaceWith", Value: "$courses"}},
Copy link
Contributor

Choose a reason for hiding this comment

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

As you can see here $unwind and $replaceWith are kind of repeated between 2 branches. Can you come up with the way to add them to pagination stages too and just replace the value with the endpoint parameters?

return append(append(baseStages, sectionStages...), paginationStages...)
}

return append(baseStages, paginationStages...) // fallback (shouldn't happen because we call with either courses or sections)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think here we don't need a fallback, if the endpoint is invalid we will just panic :)

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.

2 participants