mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-10 01:23:48 +01:00
Add user storage usage to modtools page
This commit is contained in:
parent
531d6acce5
commit
0488b129fc
@ -114,3 +114,11 @@ def last_it(it):
|
|||||||
for x in it:
|
for x in it:
|
||||||
value = x
|
value = x
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
@app.template_filter()
|
||||||
|
def flatten(list):
|
||||||
|
ret = []
|
||||||
|
for x in list:
|
||||||
|
ret.extend(x)
|
||||||
|
return ret
|
||||||
|
@ -7,6 +7,23 @@
|
|||||||
{% block pane %}
|
{% block pane %}
|
||||||
<h2 class="mt-0">{{ _("Moderator Tools") }}</h2>
|
<h2 class="mt-0">{{ _("Moderator Tools") }}</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<h3>
|
||||||
|
{{ _("Storage") }}
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
{% set all_releases = user.packages | map(attribute="releases") | flatten %}
|
||||||
|
{% set all_screenshots = user.packages | map(attribute="screenshots") | flatten %}
|
||||||
|
{% set release_size = ((all_releases | sum(attribute="file_size_bytes")) / 1048576) | round %}
|
||||||
|
{% set screenshot_size = ((all_screenshots | sum(attribute="file_size_bytes")) / 1048576) | round %}
|
||||||
|
<p>
|
||||||
|
{{ _("Total storage usage is %(total_size)d MB (releases %(release_size)d MB, screenshots %(screenshot_size)d MB).",
|
||||||
|
release_size=release_size, screenshot_size=screenshot_size, total_size=release_size + screenshot_size) }}
|
||||||
|
<br>
|
||||||
|
{{ _("%(releases)d releases and %(screenshots)d screenshots.",
|
||||||
|
releases=all_releases | length, screenshots=all_screenshots | length) }}
|
||||||
|
</p>
|
||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
{{ _("Edit Account") }}
|
{{ _("Edit Account") }}
|
||||||
</h3>
|
</h3>
|
||||||
|
Loading…
Reference in New Issue
Block a user