Minor enhancements
* refactors eco account rest surface calculation into designated method get_available_rest() * refactors placeholder setter for BaseForm * adds automatic eco account identifier generating on saving * fixes ServerMessageImportance template tag
This commit is contained in:
@@ -238,10 +238,7 @@ class EcoAccountTable(BaseTable):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
withdraws = record.withdraws.all()
|
||||
withdraw_surfaces = withdraws.aggregate(Sum("surface"))["surface__sum"] or 0
|
||||
after_states_surfaces = record.after_states.all().aggregate(Sum("surface"))["surface__sum"] or withdraw_surfaces ## no division by zero
|
||||
value = int(((after_states_surfaces - withdraw_surfaces) / after_states_surfaces) * 100)
|
||||
value = record.get_available_rest(as_percentage=True)
|
||||
html = render_to_string("konova/custom_widgets/progressbar.html", {"value": value})
|
||||
return format_html(html)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user