From 7514395effd96e1a53a25e530d5c54d0daeedbd8 Mon Sep 17 00:00:00 2001 From: Philipp Date: Mon, 3 May 2021 22:22:01 +0200 Subject: [PATCH 1/3] fixed amd dependency --- frontend/src/app/_services/api.service.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/app/_services/api.service.ts b/frontend/src/app/_services/api.service.ts index 07f7d31..0806b68 100644 --- a/frontend/src/app/_services/api.service.ts +++ b/frontend/src/app/_services/api.service.ts @@ -7,8 +7,7 @@ import { HttpResponse } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { Observable, Subscription } from 'rxjs'; -import { throwError } from 'rxjs/internal/observable/throwError'; +import { Observable, Subscription, throwError } from 'rxjs'; import { retry, catchError } from 'rxjs/operators'; import { environment } from 'src/environments/environment'; import { From ede3434f07981469b6434ed46814e5976876f737 Mon Sep 17 00:00:00 2001 From: Philipp Date: Mon, 3 May 2021 22:22:24 +0200 Subject: [PATCH 2/3] fixed delete functions --- frontend/src/app/_services/db.service.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/_services/db.service.ts b/frontend/src/app/_services/db.service.ts index efe2dfe..5629b9e 100644 --- a/frontend/src/app/_services/db.service.ts +++ b/frontend/src/app/_services/db.service.ts @@ -47,13 +47,18 @@ export class DbService extends Dexie { ); } - async deleteSubject(subjectId: number): Promise { - await this.subjects.delete(subjectId); - await this.flashcards.where('subjectId').equals(subjectId).delete(); + async deleteSubject(studySmarterId: number): Promise { + const subject = await this.subjects + .where('studySmarter.id') + .equals(studySmarterId) + .first(); + if (!subject?.id) return; + await this.subjects.delete(subject.id); + await this.flashcards.where('subjectId').equals(subject.id).delete(); } - async deleteSubjects(subjectIds: number[]): Promise { - await Promise.all(subjectIds.map((id) => this.deleteSubject(id))); + async deleteSubjects(studySmarterIds: number[]): Promise { + await Promise.all(studySmarterIds.map((id) => this.deleteSubject(id))); } addFlashcards( From c4fb007dfe0edfbdd6d80ee06e17645dcd187c32 Mon Sep 17 00:00:00 2001 From: Pius Walter Date: Tue, 4 May 2021 10:08:33 +0200 Subject: [PATCH 3/3] Fixed typo --- frontend/src/app/home/flashcard/flashcard.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/home/flashcard/flashcard.component.html b/frontend/src/app/home/flashcard/flashcard.component.html index ce47e40..ca2d136 100644 --- a/frontend/src/app/home/flashcard/flashcard.component.html +++ b/frontend/src/app/home/flashcard/flashcard.component.html @@ -34,7 +34,7 @@ > Correct 🥳 That was probably not quite tivial 😨That was probably not quite trivial 😨