File tree Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change 18
18
19
19
20
20
def int_list (l ):
21
+ if not l :
22
+ return None
21
23
return list (map (int , filter (lambda x : x .isnumeric (), l )))
22
24
23
25
24
26
class ProblemList (ListView , mixin .MetaMixin ):
25
27
template_name = "problem/list.html"
26
28
context_object_name = "problems"
27
- paginate_by = 50
29
+ paginate_by = 35
28
30
title = "Practice Problems"
29
31
30
32
def get_queryset (self ):
33
+ base = models .Problem .get_visible_problems (self .request .user ).prefetch_related (
34
+ "problem_type" , "problem_group"
35
+ )
36
+
37
+ if self .selected_types is not None :
38
+ base = base .filter (problem_type__in = self .selected_types )
39
+ if self .selected_groups is not None and not self .request .in_contest :
40
+ base = base .filter (problem_group__in = self .selected_groups )
41
+
31
42
q = (
32
- models .Problem .get_visible_problems (self .request .user )
33
- .prefetch_related ("problem_type" , "problem_group" )
34
- .filter (
35
- Q (problem_type__in = self .selected_types ) if len (self .selected_types ) else Q (),
36
- (
37
- Q (problem_group__in = self .selected_groups )
38
- if len (self .selected_groups ) and not self .request .in_contest
39
- else Q ()
40
- ),
41
- )
42
- .distinct ()
43
+ base .distinct ()
43
44
.order_by ("points" , "name" )
44
45
)
45
46
if self .hide_solved and self .request .user .is_authenticated :
You can’t perform that action at this time.
0 commit comments