Skip to content

Commit

Permalink
More FSU fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenswat committed Feb 7, 2024
1 parent a2585dc commit e4712a0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@
],
"abyssal_fighter_support_unit": [
(2336, True),
(2337, False),
(2338, False),
(2337, True),
(2338, True),
(50, False),
(30, False),
(2335, True),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{% load static %}
{% load module_stats %}

<div class="form-group col-12 col-md-6">
<div class="row">
<label class="col-6"><img src="{% static at.icon_path %}" title="{{ at.name }}"> {{ at.name }}{% if at.derived %}<span style="text-muted" title="This is a derived attribute.">*</span>{% endif %}</label>
<div class="input-group input-group-sm col-3">
<input type="number" class="form-control form-control-sm module-attribute-filter {{ at.high_is_good|yesno:'negative,positive' }}" id="attr-{{ at.id }}-min" data-attr-modified="{{ at.id }}" step="0.0001">
<input type="number" class="form-control form-control-sm module-attribute-filter {{ at|rendered_high_is_good|yesno:'negative,positive' }}" id="attr-{{ at.id }}-min" data-attr-modified="{{ at.id }}" step="0.0001">
<div class="input-group-append module-stat-unit">
<span class="input-group-text">{{ at.unit_str }}</span>
</div>
</div>
<div class="input-group input-group-sm col-3">
<input type="number" class="form-control form-control-sm module-attribute-filter {{ at.high_is_good|yesno:'positive,negative' }}" id="attr-{{ at.id }}-max" data-attr-modified="{{ at.id }}" step="0.0001">
<input type="number" class="form-control form-control-sm module-attribute-filter {{ at|rendered_high_is_good|yesno:'positive,negative' }}" id="attr-{{ at.id }}-max" data-attr-modified="{{ at.id }}" step="0.0001">
<div class="input-group-append module-stat-unit">
<span class="input-group-text">{{ at.unit_str }}</span>
</div>
Expand Down
4 changes: 4 additions & 0 deletions backend/abyssal_modules/templatetags/module_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from abyssal_modules.utils import (
format_attribute_basic as fb,
render_attribute_value as rv,
correct_high_is_good as hg
)


Expand All @@ -20,6 +21,9 @@ def format_attribute(mod, attr):
def format_attribute_basic(val, attr):
return fb(val, attr)

@register.filter
def rendered_high_is_good(at):
return hg(at.id, at.high_is_good)

@register.filter()
def delta(d, attr):
Expand Down
4 changes: 4 additions & 0 deletions backend/abyssal_modules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,9 @@ def render_attribute_value(val, attr):
def correct_high_is_good(val, attr):
if attr == 204:
return not val
elif attr == 2337:
return not val
elif attr == 2338:
return not val
else:
return val
10 changes: 9 additions & 1 deletion backend/static/js/mutaplasmid.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,16 @@ function render_attr(attr_id, val) {
return val;
}

function rendered_high_is_good(attr_id, val) {
if (attr_id == 2335 || attr_id == 2336 || attr_id == 2337 || attr_id == 2338) {
return true;
} else {
return val;
}
}

function attr_format(attr, data) {
base = `<span class='attr-${attr} attr-cell'>${data.real_value.toFixed(get_precision(attr))}</span>`;
base = `<span class='attr-${attr} attr-cell'>${render_attr(attr, data.real_value).toFixed(get_precision(attr))}</span>`;

if (data.rating != null && display_rating(attr)) {
if (data.rating > 0) {
Expand Down

0 comments on commit e4712a0

Please sign in to comment.