Skip to content

Commit

Permalink
Merge pull request #23 from piuswalter/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
p-fruck authored May 4, 2021
2 parents 0cbbd5c + 1fc9811 commit d504a0a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
3 changes: 1 addition & 2 deletions frontend/src/app/_services/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
15 changes: 10 additions & 5 deletions frontend/src/app/_services/db.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,18 @@ export class DbService extends Dexie {
);
}

async deleteSubject(subjectId: number): Promise<void> {
await this.subjects.delete(subjectId);
await this.flashcards.where('subjectId').equals(subjectId).delete();
async deleteSubject(studySmarterId: number): Promise<void> {
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<void> {
await Promise.all(subjectIds.map((id) => this.deleteSubject(id)));
async deleteSubjects(studySmarterIds: number[]): Promise<void> {
await Promise.all(studySmarterIds.map((id) => this.deleteSubject(id)));
}

addFlashcards(
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/home/flashcard/flashcard.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
>
<span *ngIf="isAnswerCorrect">Correct 🥳</span>
<span *ngIf="!isAnswerCorrect"
>That was probably not quite tivial 😨</span
>That was probably not quite trivial 😨</span
>
</div>
<div
Expand Down

0 comments on commit d504a0a

Please sign in to comment.