refactor: centralize globalKey construction via buildGlobalKey()

This commit is contained in:
edde746
2026-02-23 17:53:20 +01:00
parent ef2c464dd4
commit e23f472d78
21 changed files with 65 additions and 48 deletions
+3 -2
View File
@@ -7,6 +7,7 @@ import 'package:path/path.dart' as p;
import 'tables.dart';
import '../models/download_models.dart';
import '../utils/app_logger.dart';
import '../utils/global_key_utils.dart';
part 'app_database.g.dart';
@@ -99,7 +100,7 @@ class AppDatabase extends _$AppDatabase {
required int duration,
required bool shouldMarkWatched,
}) async {
final globalKey = '$serverId:$ratingKey';
final globalKey = buildGlobalKey(serverId, ratingKey);
final now = DateTime.now().millisecondsSinceEpoch;
// Check for existing progress entry
@@ -144,7 +145,7 @@ class AppDatabase extends _$AppDatabase {
required String ratingKey,
required String actionType, // 'watched' or 'unwatched'
}) async {
final globalKey = '$serverId:$ratingKey';
final globalKey = buildGlobalKey(serverId, ratingKey);
final now = DateTime.now().millisecondsSinceEpoch;
// Remove conflicting actions (opposite action type and progress)