carp-dk / carp-dk/carp_study_app

fix(time): guard day-based calculations against clock changes

Open
#631 0 comments 0 reactions 1 assignee Claimed by @Zeroupper View on GitHub
Dominant language
Dart
Stars
10
Forks
5
Avg merge
1d 3h
Merged PRs (30d)
14

Description

## Problem
(verified) `daysInStudy` is `DateTime.now().difference(status.createdOn).inDays` (`lib/view_models/tasklist_page_model.dart:41-45`) — a clock set backwards yields negative days; similar `DateTime.now()` math drives card models.

## Proposed fix
Clamp to >= 0 and centralize "study day" computation in one tested helper (StudyService, #594); inject a clock for testability.

## Acceptance criteria
- [ ] Unit tests for clock-backwards/forwards
- [ ] No negative day counts

**Effort:** S · **Priority:** P3 · **Change risk:** None

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.