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: add capabilty in queryset method to exclude hidden runs #4443

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

AfaqShuaib09
Copy link
Contributor

@AfaqShuaib09 AfaqShuaib09 commented Sep 11, 2024

PROD-4177

This PR adds the capability in populate_product_catalog command to exclude hidden available runs from the queryset.

Testing:

  • Create a run from publisher and publish it. Make it hidden from django admin (both darft and non-draft)
  • Run the following command from discovery shell.
python manage.py populate_product_catalog --product_type={product_type} --output_csv=/path/to/output.csv --product_source={product_source}
  • Verify Course having only hidden published runs are excluded from the catalog

@AfaqShuaib09 AfaqShuaib09 marked this pull request as ready for review September 11, 2024 14:30
@AfaqShuaib09 AfaqShuaib09 marked this pull request as draft September 11, 2024 14:31
@AfaqShuaib09 AfaqShuaib09 marked this pull request as ready for review September 11, 2024 14:54
Copy link
Contributor

@Ali-D-Akbar Ali-D-Akbar left a comment

Choose a reason for hiding this comment

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

Looks good to me overall.

@AfaqShuaib09 AfaqShuaib09 force-pushed the afaq/prod-4177 branch 3 times, most recently from 99142f7 to 852fcc6 Compare September 13, 2024 06:57
@@ -54,7 +54,12 @@ def available(self):
# By itself, the query performs a join across several tables and would return
# the id of the same course multiple times (a separate copy for each available
# seat in each available run).
ids = self.filter(enrollable & not_ended & marketable).values('id').distinct()
if exclude_hidden_runs:
# A CourseRun is "hidden" if it has a "hidden" attribute set to True.
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need for the comment here, the code is fairly obvious here.

@AfaqShuaib09 AfaqShuaib09 force-pushed the afaq/prod-4177 branch 2 times, most recently from 1b4f230 to b6ea01d Compare September 13, 2024 07:27
@AfaqShuaib09 AfaqShuaib09 merged commit 537fcd4 into master Sep 13, 2024
11 of 12 checks passed
@AfaqShuaib09 AfaqShuaib09 deleted the afaq/prod-4177 branch September 13, 2024 18:33
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