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

feat(projects): add check for finding next relevant page #1192

Open
wants to merge 2 commits into
base: 2.3.0
Choose a base branch
from

Conversation

MyPyDavid
Copy link
Member

@MyPyDavid MyPyDavid commented Nov 13, 2024

Description

Related issue: #1191

Adds the method compute_next_relevant_page in progress.py.
Refactors compute_show_page to be able to re-used in ProjectPageViewSet for finding the next relevant page.

Motivation and Context

How has this been tested?

Screenshots (if appropriate)

@MyPyDavid MyPyDavid self-assigned this Nov 13, 2024
@MyPyDavid MyPyDavid force-pushed the 1191-interview-slow-loading-on-proceed-when-a-lot-of-conditional-pages-are-skipped branch from 9796e9e to f3b8850 Compare November 13, 2024 10:10
@MyPyDavid MyPyDavid changed the base branch from main to 2.3.0 November 13, 2024 10:11
@MyPyDavid MyPyDavid changed the base branch from 2.3.0 to main November 13, 2024 10:14
@MyPyDavid MyPyDavid changed the base branch from main to 2.3.0 November 13, 2024 10:15
@MyPyDavid MyPyDavid force-pushed the 1191-interview-slow-loading-on-proceed-when-a-lot-of-conditional-pages-are-skipped branch from f3b8850 to 9756d2c Compare November 13, 2024 10:18
@MyPyDavid MyPyDavid force-pushed the 1191-interview-slow-loading-on-proceed-when-a-lot-of-conditional-pages-are-skipped branch from 3e06cd8 to c90ea63 Compare November 14, 2024 14:22
@MyPyDavid MyPyDavid force-pushed the 1191-interview-slow-loading-on-proceed-when-a-lot-of-conditional-pages-are-skipped branch from c90ea63 to f788af7 Compare November 25, 2024 10:28
@MyPyDavid MyPyDavid force-pushed the 1191-interview-slow-loading-on-proceed-when-a-lot-of-conditional-pages-are-skipped branch from f4d75ac to 6f8244e Compare November 27, 2024 16:20
@MyPyDavid MyPyDavid marked this pull request as ready for review November 27, 2024 18:01
@MyPyDavid MyPyDavid added this to the RDMO 2.3.0 milestone Nov 28, 2024
Copy link
Member

@jochenklar jochenklar left a comment

Choose a reason for hiding this comment

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

Awesome, works nicely. Do we test this? Otherwise only style feedback.

rdmo/projects/progress.py Show resolved Hide resolved
rdmo/projects/progress.py Show resolved Hide resolved
max_iterations = len(catalog.pages)
iterations = 0

while iterations < max_iterations:
Copy link
Member

Choose a reason for hiding this comment

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

This could be a for loop over catalog pages (which should be ordered) beginning with current_page. Maybe this would be more elegant, idk, you decide.

Copy link
Member

Choose a reason for hiding this comment

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

Or a recursive function 😈

Copy link
Member Author

Choose a reason for hiding this comment

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

ah yes, a recursive function also goes there, it makes the function very compact and simple actually

values = self.project.values.filter(snapshot=None).select_related('attribute', 'option')

if check_conditions(conditions, values):
sets = compute_sets(values)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder how much more expensive this is. In the future we could move functions like compute_sets to the manager. Just having ideas...

@MyPyDavid
Copy link
Member Author

ok thanks! Yes think that a certain specific test case would be maybe appropriate here, I'll add one.

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.

Interview, slow loading on proceed when a lot of conditional pages are skipped.
2 participants