Skip to content

Commit

Permalink
Fix embeds for FSUs
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenswat committed Feb 5, 2024
1 parent 3ee5314 commit 02a4600
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

{% block metadata %}
<meta property="og:title" content="{{ object.creator.name }}'s Modified {{ object.type.name }}" />
<meta property="og:image" content="{{ image_url }}?v=2" />
<meta property="og:image" content="{{ image_url }}?v=3" />
<meta property="og:site_name" content="mutaplasmid.space" />
<meta property="og:image:type" content="image/png">
<meta name="twitter:card" content="summary_large_image">
Expand Down
7 changes: 5 additions & 2 deletions backend/abyssal_modules/templatetags/module_stats.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from django import template

from abyssal_modules.utils import format_attribute_basic as fb
from abyssal_modules.utils import (
format_attribute_basic as fb,
render_attribute_value as rv,
)


register = template.Library()
Expand All @@ -10,7 +13,7 @@
def format_attribute(mod, attr):
val = mod.get_value(attr)

return fb(val, attr)
return fb(rv(val, attr), attr)


@register.filter
Expand Down
20 changes: 20 additions & 0 deletions backend/abyssal_modules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ def format_attribute_basic(val, attr):
return "%.2f" % val
elif attr == 6:
return "%.2f" % val
elif attr == 2335:
return "%.3f" % val
elif attr == 2336:
return "%.3f" % val
elif attr == 2337:
return "%.3f" % val
elif attr == 2338:
return "%.3f" % val
else:
return "%.1f" % val

Expand All @@ -46,6 +54,14 @@ def render_attribute_value(val, attr):
return 100 * (1 - val)
elif attr == 977:
return 100 * (1 - val)
elif attr == 2335:
return 100 * (val - 1)
elif attr == 2336:
return 100 * (val - 1)
elif attr == 2337:
return -100 * (val - 1)
elif attr == 2338:
return -100 * (val - 1)
else:
return val

Expand All @@ -61,5 +77,9 @@ def correct_high_is_good(val, attr):
return not val
elif attr == 977:
return not val
elif attr == 2337:
return not val
elif attr == 2338:
return not val
else:
return val

0 comments on commit 02a4600

Please sign in to comment.