fix(time-entries): use server time for running timers

This commit is contained in:
2026-05-21 13:01:51 +03:30
parent 0fea265cfb
commit e234eac26d
4 changed files with 59 additions and 14 deletions

View File

@@ -47,6 +47,18 @@ class TimeEntryServiceTests(TestCase):
self.assertIsNotNone(stopped_entry.end_time)
self.assertIsNotNone(stopped_entry.duration)
def test_create_running_time_entry_defaults_start_time_to_server_now(self):
before = timezone.now()
entry = create_time_entry(
user=self.user,
workspace_id=self.workspace.id,
)
after = timezone.now()
self.assertIsNone(entry.end_time)
self.assertGreaterEqual(entry.start_time, before)
self.assertLessEqual(entry.start_time, after)
def test_update_time_entry_preserves_deleted_project_and_tags(self):
project = Project.objects.create(workspace=self.workspace, name="Deleted project")
tag = Tag.objects.create(