harvard-lil / h2o

H2O is a web app for creating and reading open educational resources, primarily in the legal field
https://opencasebook.org
GNU Affero General Public License v3.0
37 stars 30 forks source link

Add an endpoint that will generate a PDF; part of #1801 #1892

Closed lizadaly closed 1 year ago

lizadaly commented 1 year ago

Working sketch of generating a PDF from a user endpoint, with the following limitations:

If you copy the generated PDF off the Docker container, you can see that it works:

image

There's a button on the frontend to trigger the endpoint, only visible to admins:

image

I switched the label to "Beta" from "admin only" in preparation for making some of this eventually available to end users, and changed "HTML preview" to "Reading mode", a name which I also don't like.

Next steps

I think this could be merged once approved. I'm curious to see how error reporting ends up working Sentry for the task— requesting a non-public casebook should be an easy way to trigger an error.

codecov-commenter commented 1 year ago

Codecov Report

Merging #1892 (f903094) into develop (48a5fb1) will decrease coverage by 0.04%. The diff coverage is 48.00%.

@@             Coverage Diff             @@
##           develop    #1892      +/-   ##
===========================================
- Coverage    76.76%   76.72%   -0.04%     
===========================================
  Files           55       54       -1     
  Lines         6628     6643      +15     
===========================================
+ Hits          5088     5097       +9     
- Misses        1540     1546       +6     
Impacted Files Coverage Δ
web/main/urls.py 100.00% <ø> (ø)
web/main/tasks.py 42.22% <31.57%> (-57.78%) :arrow_down:
web/main/test/functional/test_functional.py 61.11% <100.00%> (ø)
web/main/test/test_permissions.py 97.11% <100.00%> (+0.02%) :arrow_up:
web/main/views.py 71.97% <100.00%> (+0.20%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.