fix: Números shows no pace for under a quarter of an hour in Imprimindo
All checks were successful
Build and deploy / Validate source (push) Successful in 4s
Build and deploy / Integration suite on a real stack (push) Successful in 6m29s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m5s

A machine whose only finished order passed through Imprimindo in seconds
showed 110671,5 m per hour. The pace (per machine and month by month) now
needs at least 15 minutes of printing time and shows a dash below that.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-16 14:10:29 -03:00
parent 4f584fed8a
commit 66bc2b9b03
3 changed files with 28 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ import unittest
from datetime import datetime, timedelta
from zoneinfo import ZoneInfo
from app.machine_stats import month_bounds, ratios
from app.machine_stats import month_bounds, pace, ratios
SAO_PAULO = ZoneInfo('America/Sao_Paulo')
@@ -74,5 +74,18 @@ class RatiosTest(unittest.TestCase):
self.assertIsNone(value['payback_months'])
class PaceTest(unittest.TestCase):
def test_seconds_in_imprimindo_give_no_pace(self):
# 16/11: an order moved through Imprimindo in seconds showed 110671,5 m/h.
self.assertIsNone(pace(1.01, 10 / 3600))
self.assertIsNone(pace(5, 0))
self.assertIsNone(pace(5, None))
def test_a_quarter_of_an_hour_gives_the_pace(self):
self.assertEqual(pace(5, 0.25), 20.0)
self.assertEqual(pace(1.5, 0.5), 3.0)
if __name__ == '__main__':
unittest.main()