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

Add degree and concentration names #60

Merged
merged 2 commits into from
Mar 28, 2024
Merged

Add degree and concentration names #60

merged 2 commits into from
Mar 28, 2024

Conversation

Clue88
Copy link

@Clue88 Clue88 commented Mar 28, 2024

No description provided.

Copy link

@vcai122 vcai122 left a comment

Choose a reason for hiding this comment

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

LGTM

"""
if not rule_ids:
return queryset
query = Q()
for rule_id in rule_ids.split(","):
for rule_id in rule_ids.split(","):
try:
rule = Rule.objects.get(id=int(rule_id))
Copy link

Choose a reason for hiding this comment

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

pref: Rule.objects.filter(id=int(rule_id)) instead of try catch.
also can use walrus operator.

if not (rule := Rule.objects.filter(id=int(rule_id)).first()): continue
if not (q := rule.get_q_object()): continue

)
.order_by("-semester")
.first()
)
Copy link

Choose a reason for hiding this comment

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

technically Min might will generate a better query for the db but not a big deal

@Clue88 Clue88 merged commit 640d5d3 into master Mar 28, 2024
4 of 8 checks passed
@Clue88 Clue88 deleted the degree-names branch March 28, 2024 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants