aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/viewsets/bot
diff options
context:
space:
mode:
authorGravatar Rohan Reddy Alleti <[email protected]>2022-02-17 02:55:28 +0530
committerGravatar GitHub <[email protected]>2022-02-16 21:25:28 +0000
commit15cac33dd74219a762d3c066efca383552f666b0 (patch)
tree3ee3c9188ecac00ec11f986a5db5a2b250a16d96 /pydis_site/apps/api/viewsets/bot
parentMerge pull request #660 from python-discord/659/lemon/resource_search_bar (diff)
Return random off topic names which are Active only (#644)
Co-authored-by: Xithrius <[email protected]>
Diffstat (limited to 'pydis_site/apps/api/viewsets/bot')
-rw-r--r--pydis_site/apps/api/viewsets/bot/off_topic_channel_name.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/pydis_site/apps/api/viewsets/bot/off_topic_channel_name.py b/pydis_site/apps/api/viewsets/bot/off_topic_channel_name.py
index 78f8c340..d0519e86 100644
--- a/pydis_site/apps/api/viewsets/bot/off_topic_channel_name.py
+++ b/pydis_site/apps/api/viewsets/bot/off_topic_channel_name.py
@@ -108,7 +108,7 @@ class OffTopicChannelNameViewSet(ModelViewSet):
'random_items': ["Must be a positive integer."]
})
- queryset = self.queryset.order_by('used', '?')[:random_count]
+ queryset = self.queryset.filter(active=True).order_by('used', '?')[:random_count]
# When any name is used in our listing then this means we reached end of round
# and we need to reset all other names `used` to False
@@ -133,7 +133,6 @@ class OffTopicChannelNameViewSet(ModelViewSet):
return Response(serialized.data)
params = {}
-
if active_param := request.query_params.get("active"):
params["active"] = active_param.lower() == "true"