Describe the bug
On my new Ourchive instance, I created a single work with tags and then deleted that work, leaving the tags existing but with zero uses. I was then redirected to the front page, which showed a ZeroDivisionError. Deleting all the tags didn't fix this error. The strange thing is that I certainly didn't have this error originally, when there were no tags in the database at all. I tried dropping the Ourchive database and recreating it (following the Getting Started instructions), but the error persisted.
The problem seems to be that font size for the Top Tags displayed on the front page is calculated by dividing by the highest tag use count, which of course causes a problem when this is 0.
Aha, just saw that this is already fixed in both production and v0.5.5.1, which is why it wasn't breaking for me before. :sweat_smile: I must have switched branches at some point. Closing this!
Describe the bug On my new Ourchive instance, I created a single work with tags and then deleted that work, leaving the tags existing but with zero uses. I was then redirected to the front page, which showed a
ZeroDivisionError
. Deleting all the tags didn't fix this error. The strange thing is that I certainly didn't have this error originally, when there were no tags in the database at all. I tried dropping the Ourchive database and recreating it (following the Getting Started instructions), but the error persisted.The problem seems to be that font size for the Top Tags displayed on the front page is calculated by dividing by the highest tag use count, which of course causes a problem when this is 0.
https://github.com/c-e-p/ourchive/blob/48a4b90c2a2b6449215b68d6053d140e1205de16/ourchive_app/frontend/views.py#L30-L43
To Reproduce
OURCHIVE_DEBUG=True
in.env
ZeroDivisionError
Expected behavior Deleting a work should not break the display of the front page.
Desktop (please complete the following information):
Hosting Digital Ocean droplet running Ubuntu 22.04.
Additional context Logs from accessing the front page after deleting the only work with tags: