Implementierung der Games #203

Merged
flixcoo merged 34 commits from feature/119-implementierung-der-games-2 into development 2026-05-09 17:13:46 +00:00
4 changed files with 8 additions and 6 deletions
Showing only changes of commit 9896008335 - Show all commits

View File

@@ -354,7 +354,7 @@ class MatchDao extends DatabaseAccessor<AppDatabase> with _$MatchDaoMixin {
sneeex marked this conversation as resolved
Review

würde man das nicht eher in game dao packen? weil es geht doch um games und die damit assozierten matches und nicht andersrum, das steht auch im string da falsch

würde man das nicht eher in game dao packen? weil es geht doch um games und die damit assozierten matches und nicht andersrum, das steht auch im string da falsch
Review

Nein, ich will die Anzahl an Matches mit einer spezifischen Game-ID. Ich frage ja auch den Match Table an, deswegen ists in der matchDao

Nein, ich will die Anzahl an Matches mit einer spezifischen Game-ID. Ich frage ja auch den Match Table an, deswegen ists in der matchDao
/// Retrieves all matches associated with the given [groupId].
/// Queries the database directly, filtering by [groupId].
Future<List<Match>> getGroupMatches({required String groupId}) async {
Future<List<Match>> getMatchesByGroup({required String groupId}) async {
final query = select(matchTable)..where((m) => m.groupId.equals(groupId));
final rows = await query.get();

View File

@@ -197,7 +197,7 @@ class _CreateGroupViewState extends State<CreateGroupView> {
/// obsolete. For each such match, the group association is removed by setting
/// its [groupId] to null.
Future<void> deleteObsoleteMatchGroupRelations() async {
final groupMatches = await db.matchDao.getGroupMatches(
final groupMatches = await db.matchDao.getMatchesByGroup(
groupId: widget.groupToEdit!.id,
);

View File

@@ -244,7 +244,9 @@ class _GroupDetailViewState extends State<GroupDetailView> {
/// Loads statistics for this group
Future<void> _loadStatistics() async {
isLoading = true;
final groupMatches = await db.matchDao.getGroupMatches(groupId: _group.id);
final groupMatches = await db.matchDao.getMatchesByGroup(
groupId: _group.id,
);
setState(() {
totalMatches = groupMatches.length;

View File

@@ -241,15 +241,15 @@ void main() {
expect(matchExists, isTrue);
});
test('getGroupMatches() works correctly', () async {
var matches = await database.matchDao.getGroupMatches(
test('getMatchesByGroup() works correctly', () async {
var matches = await database.matchDao.getMatchesByGroup(
groupId: 'non-existing-id',
);
expect(matches, isEmpty);
await database.matchDao.addMatch(match: testMatch1);
matches = await database.matchDao.getGroupMatches(
matches = await database.matchDao.getMatchesByGroup(
groupId: testGroup1.id,
);
expect(matches, isNotEmpty);