Skip to content

Commit

Permalink
Merge pull request #1937 from bartblaze/master
Browse files Browse the repository at this point in the history
Add dots for decimal separator
  • Loading branch information
doomedraven authored Mar 9, 2024
2 parents edb6b17 + 75de6c9 commit 4228600
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions web/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,20 @@ def __call__(self, func):
return self.decorator(func)


def format_number_with_space(number):
return f"{number:,}".replace(',',' ')

@require_safe
@conditional_login_required(login_required, settings.WEB_AUTHENTICATION)
def index(request):
db = Database()

report = dict(
total_samples=db.count_samples(), total_tasks=db.count_tasks(), states_count={}, estimate_hour=None, estimate_day=None
total_samples=format_number_with_space(db.count_samples()),
total_tasks=format_number_with_space(db.count_tasks()),
states_count={},
estimate_hour=None,
estimate_day=None
)

states = (
Expand Down Expand Up @@ -79,8 +86,8 @@ def index(request):
else:
hourly = 0

report["estimate_hour"] = int(hourly)
report["estimate_day"] = int(24 * hourly)
report["estimate_hour"] = format_number_with_space(int(hourly))
report["estimate_day"] = format_number_with_space(int(24 * hourly))
report["top_detections"] = top_detections()

return render(request, "dashboard/index.html", {"report": report})

0 comments on commit 4228600

Please sign in to comment.