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: statistics API #4

Merged
merged 1 commit into from
Apr 18, 2024
Merged

Conversation

shadinaif
Copy link
Collaborator

@shadinaif shadinaif commented Mar 8, 2024

feat: statistics API

@shadinaif shadinaif force-pushed the shadinaif/dashbord-stats-learners-count branch 2 times, most recently from 3d9a001 to 375adc9 Compare March 12, 2024 06:53
@shadinaif shadinaif force-pushed the shadinaif/dashbord-stats-learners-count branch 6 times, most recently from bc6b3af to 514889a Compare March 27, 2024 06:46
@shadinaif shadinaif changed the title feat: learners-count statistics feat: statistics APIs Mar 27, 2024
@shadinaif shadinaif changed the title feat: statistics APIs feat: statistics API Mar 27, 2024
@shadinaif shadinaif force-pushed the shadinaif/dashbord-stats-learners-count branch 2 times, most recently from 22d6afe to 193dd9c Compare March 28, 2024 13:45
@shadinaif shadinaif force-pushed the shadinaif/dashbord-stats-learners-count branch from 193dd9c to 7daf9dc Compare March 28, 2024 13:48
Copy link
Collaborator

@OmarIthawi OmarIthawi left a comment

Choose a reason for hiding this comment

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

@shadinaif please go ahead and merge this pull request. I wasn't aware it was blocked by review.

)
)
).filter(
Q(courses_count__gt=0) | Q(has_site_login=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why this is the case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We need the list of users related to the tenant. So, the user must be enrolled in one of the tenant's courses, or have a site login in the tenant's site

from futurex_openedx_extensions.helpers.tenants import get_course_org_filter_list, get_tenant_site


def get_learners_queryset(tenant_ids: List, search_text: str = None) -> QuerySet:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This query is a bit slow on production. Any idea how can we make it faster?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe the issue is not this particular query. It's the other helper queries, you'll find a few methods with TODO to add cache. These will increase the performance significantly as far as I can see

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if caching didn't fix it, we might need to do something with UserSignupSource. We need it to record logins, not just signups. So we can use it to directly filter the user by site.

Currently, there are too many records for users with enrollments in a site, but without a record in UserSignupSource

@shadinaif shadinaif merged commit 6add8d9 into main Apr 18, 2024
2 checks passed
@shadinaif shadinaif deleted the shadinaif/dashbord-stats-learners-count branch April 18, 2024 10:22
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