fix(programmer-tasks): tab switching + help-given live data

Tab switching: _buildTabs was recreating TabController on every build
because `_tabs == tabs` compares List by reference identity, not content.
programmerTasksTabsFor() always returns a new list, so the guard was
always false, resetting the controller to initialIndex 0 on every tap.
Fixed by using listEquals from flutter/foundation.

Help given: computeProgrammerStats accumulated helpGivenThisMonth only
from approvedSnapshot rows, which only exist after admin approval.
Programmers who helped others but had pending sheets saw 0m indefinitely.
Fixed by adding helpGivenThisMonthProvider (FutureProvider.family) that
queries programmer_task_work_logs directly for the current Manila month,
and passing it as liveHelpThisMonthSec to computeProgrammerStats.

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
2026-09-28 22:25:25 +08:00
parent 4f60e23003
commit 2946945ce3
4 changed files with 42 additions and 4 deletions
@@ -47,6 +47,9 @@ class ProgrammerDashboard extends ConsumerWidget {
final sheetsAsync = ref.watch(daySheetsForUserProvider(userId));
final sheets = sheetsAsync.valueOrNull ?? const <ProgrammerDaySheet>[];
final liveHelpThisMonthSec =
ref.watch(helpGivenThisMonthProvider(userId)).valueOrNull;
final tasks = tasksAsync.valueOrNull ?? const [];
final profileById = <String, Profile>{
for (final p in profilesAsync.valueOrNull ?? <Profile>[]) p.id: p,
@@ -82,6 +85,7 @@ class ProgrammerDashboard extends ConsumerWidget {
sheets: sheets,
leaveDays: leaveDays,
todayFocus: todayFocus,
liveHelpThisMonthSec: liveHelpThisMonthSec,
);
final showSheetStats =