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

Pagination and more macros #1101

Merged
merged 5 commits into from
Jan 27, 2019

Conversation

stefano-maggiolo
Copy link
Member

@stefano-maggiolo stefano-maggiolo commented Jan 19, 2019

If you think you'll have more than a few comments let me know and I'll split into more PRs.

Partially fixes #1097.


This change is Reviewable

@codecov
Copy link

codecov bot commented Jan 19, 2019

Codecov Report

Merging #1101 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1101      +/-   ##
=========================================
- Coverage   62.02%     62%   -0.02%     
=========================================
  Files         230     230              
  Lines       16587   16587              
=========================================
- Hits        10288   10285       -3     
- Misses       6299    6302       +3
Flag Coverage Δ
#functionaltests 45.77% <ø> (-0.07%) ⬇️
#unittests 43.25% <ø> (-0.01%) ⬇️
Impacted Files Coverage Δ
cms/server/admin/handlers/task.py 39.84% <0%> (-1.18%) ⬇️
cms/service/EvaluationService.py 67.28% <0%> (-1.07%) ⬇️
cms/db/base.py 84.04% <0%> (-1.07%) ⬇️
cms/server/admin/handlers/dataset.py 24.76% <0%> (-0.93%) ⬇️
cms/db/util.py 50.37% <0%> (-0.75%) ⬇️
cms/db/filecacher.py 77.37% <0%> (-0.66%) ⬇️
cms/grading/Sandbox.py 68.23% <0%> (-0.37%) ⬇️
cms/server/admin/handlers/base.py 68.13% <0%> (+0.33%) ⬆️
cms/db/usertest.py 95.71% <0%> (+0.71%) ⬆️
cms/service/ResourceService.py 58.9% <0%> (+0.91%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 584cc42...58856f5. Read the comment docs.

Copy link
Member

@lw lw left a comment

Choose a reason for hiding this comment

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

Didn't test it, but the code looks alright.

:lgtm:

Reviewed 3 of 3 files at r1, 1 of 1 files at r2, 8 of 8 files at r3, 2 of 2 files at r4, 5 of 5 files at r5.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @stefano-maggiolo)


cms/server/admin/templates/macro/pages.html, line 21 at r1 (raw file):

    {% endfor %}
  {% endif %}
</div>

The outer if and the div are nested incorrectly.


cms/server/admin/templates/macro/pages.html, line 25 at r2 (raw file):

    {% endif %}
  {% endif %}
</div>

Same nesting issue.


cms/server/admin/templates/macro/pages.html, line 33 at r2 (raw file):

Show a page range selector from start (included) to end (excluded).
#}
  {% for i in range([0, start]|max, [pages, end]|min) %}

Dunno if it's the same in Jinja, but this syntax works in plain Python: range(pages)[start:end] (and it returns a properly capped range object)

Copy link
Member Author

@stefano-maggiolo stefano-maggiolo left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @lerks)


cms/server/admin/templates/macro/pages.html, line 21 at r1 (raw file):

Previously, lerks (Luca Wehrstedt) wrote…

The outer if and the div are nested incorrectly.

Good catch


cms/server/admin/templates/macro/pages.html, line 25 at r2 (raw file):

Previously, lerks (Luca Wehrstedt) wrote…

Same nesting issue.

Good catch


cms/server/admin/templates/macro/pages.html, line 33 at r2 (raw file):

Good catch
not if start is negative, no?

Copy link
Member Author

@stefano-maggiolo stefano-maggiolo left a comment

Choose a reason for hiding this comment

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

Thanks! Fixing in place and submitting.

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @lerks)

@andreyv
Copy link
Member

andreyv commented Jan 27, 2019

I'm getting an error on the Submissions and User tests pages with CMS installed in the system:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/tornado/web.py", line 1510, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "/usr/lib/python3/dist-packages/tornado/web.py", line 2898, in wrapper
    return method(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/cms-1.5.dev0-py3.6.egg/cms/server/admin/handlers/base.py", line 173, in newfunc
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/cms-1.5.dev0-py3.6.egg/cms/server/admin/handlers/contestsubmission.py", line 47, in get
    self.render("contest_submissions.html", **self.r_params)
  File "/usr/local/lib/python3.6/dist-packages/cms-1.5.dev0-py3.6.egg/cms/server/admin/handlers/base.py", line 281, in render
    for chunk in t.generate(**params):
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 1045, in generate
    yield self.environment.handle_exception(exc_info, True)
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3/dist-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/dist-packages/cms-1.5.dev0-py3.6.egg/cms/server/admin/templates/contest_submissions.html", line 1, in top-level template code
    {% import "macro/reevaluation_buttons.html" as macro_reevaluation_buttons %}
  File "/usr/lib/python3/dist-packages/jinja2/loaders.py", line 235, in get_source
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: macro/reevaluation_buttons.html

fragments/reevaluation_buttons.html exists on the file system instead.

@stefano-maggiolo stefano-maggiolo deleted the pagination branch January 27, 2019 21:21
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.

[AWS] Support large number of users and their artifacts
3 participants