Date: April 3, 2026 Current Phase: Phase 8 (Testing & Bug Fixes) — Continued Previous Log: Day 8 (Phase 8 test writing + bug fixes round 1)


✅ This Session Progress

Task Status
Full test suite 68 tests passing ✅ Done
Statistics screen backend integration fix ✅ Done
Dosage unit order change ✅ Done
Taken/Skipped re-selection UX improvement ✅ Done
DropdownButtonFormField overflow fix ✅ Done
Unit tests updated to match backend spec ✅ Done

1. Full Test Results

Unit tests:   51 passed
Widget tests: 17 passed
Total:        68 passed ✅

Package name fix

Test file imports used pillly_app but the actual package name is pillly.

find test/ -name "*.dart" -exec sed -i '' 's/package:pillly_app/package:pillly/g' {} \\;

2. Statistics Screen Backend Integration Fix

Problem

Flutter DoseStats model expected a different response structure than the actual backend.

Item Flutter Expected Actual Backend
Overall adherence adherenceRate (0.0~1.0) overall_rate (integer 0~100)
Breakdown weeklyBreakdown, monthlyBreakdown by_medication array

Fix

Redesigned DoseStats domain model to match actual backend response.

// Before
class DoseStats {
  final int totalDoses;
  final int doneDoses;
  final List<WeeklyStats> weeklyBreakdown;
  final List<MonthlyStats> monthlyBreakdown;
  double get adherenceRate => ...
}

// After
class MedicationStat {
  final String medicationName;
  final int rate;
  final String? colorTag;
}

class DoseStats {
  final String period;
  final int overallRate;
  final List<MedicationStat> byMedication;
}

dose_stats_screen.dart fully rewritten to match new model. Added per-medication adherence bar chart (name + percentage + color indicator).