Some more optimizations
This commit is contained in:
parent
a9dc97a46d
commit
3f6841932b
9 changed files with 65 additions and 44 deletions
|
@ -191,6 +191,9 @@ class DiggPaginator(ExPaginator):
|
|||
# validate padding value
|
||||
max_padding = int(math.ceil(self.body / 2.0) - 1)
|
||||
self.padding = kwargs.pop("padding", min(4, max_padding))
|
||||
count_override = kwargs.pop("count", None)
|
||||
if count_override is not None:
|
||||
self.__dict__["count"] = count_override
|
||||
if self.padding > max_padding:
|
||||
raise ValueError("padding too large for body (max %d)" % max_padding)
|
||||
super(DiggPaginator, self).__init__(*args, **kwargs)
|
||||
|
|
|
@ -19,14 +19,17 @@ __all__ = [
|
|||
"contest_completed_ids",
|
||||
"get_result_data",
|
||||
"user_completed_ids",
|
||||
"user_authored_ids",
|
||||
"user_editable_ids",
|
||||
"user_tester_ids",
|
||||
]
|
||||
|
||||
|
||||
def user_authored_ids(profile):
|
||||
result = set(Problem.objects.filter(authors=profile).values_list("id", flat=True))
|
||||
return result
|
||||
def user_tester_ids(profile):
|
||||
return set(
|
||||
Problem.testers.through.objects.filter(profile=profile).values_list(
|
||||
"problem_id", flat=True
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def user_editable_ids(profile):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue