feat(programmer): dated work-log corrections
Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../models/programmer_task_work_log.model.dart';
|
||||
import '../utils/programmer_daily_time.dart';
|
||||
import 'programmer_day_sheets_provider.dart';
|
||||
import 'supabase_provider.dart';
|
||||
|
||||
/// Work-log entries for a task (newest first), streamed live.
|
||||
@@ -26,19 +28,27 @@ class ProgrammerTaskWorkLogsController {
|
||||
|
||||
/// Adds a work-log entry. [minutes] is null for the assignee's progress notes
|
||||
/// (their time comes from the running clock) and set for a helper's
|
||||
/// Time Consumed.
|
||||
/// Time Consumed. [workDate] overrides the date the entry is attributed to;
|
||||
/// when null the DB default applies (today's Manila date).
|
||||
Future<void> addWorkLog({
|
||||
required String taskId,
|
||||
required String description,
|
||||
int? minutes,
|
||||
DateTime? workDate,
|
||||
}) async {
|
||||
final userId = _client.auth.currentUser?.id;
|
||||
if (userId == null) throw Exception('Not authenticated');
|
||||
await _client.from('programmer_task_work_logs').insert({
|
||||
'task_id': taskId,
|
||||
'author_id': userId,
|
||||
'description': description,
|
||||
'minutes': ?minutes,
|
||||
});
|
||||
try {
|
||||
await _client.from('programmer_task_work_logs').insert({
|
||||
'task_id': taskId,
|
||||
'author_id': userId,
|
||||
'description': description,
|
||||
'minutes': ?minutes,
|
||||
if (workDate != null) 'work_date': formatDayKey(workDate),
|
||||
});
|
||||
} catch (e) {
|
||||
if (e is DaySheetActionException) rethrow;
|
||||
throw DaySheetActionException(mapDaySheetError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user