Skip to content

Commit

Permalink
fix: fix footer height not resetting on similarity
Browse files Browse the repository at this point in the history
  • Loading branch information
jakerenzella committed Jul 14, 2023
1 parent 4f4a617 commit 19c43d7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Component, Inject, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core';
import { Component, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core';
import { MatAccordion } from '@angular/material/expansion';
import { alertService } from 'src/app/ajs-upgraded-providers';
import { Task } from 'src/app/api/models/task';
import { TaskSimilarity } from 'src/app/api/models/task-similarity';
import { TaskSimilarityService } from 'src/app/api/services/task-similarity.service';
import { AlertService } from 'src/app/common/services/alert.service';
import { SelectedTaskService } from '../../../../selected-task.service';

@Component({
selector: 'f-task-similarity-view',
Expand All @@ -16,7 +16,11 @@ export class TaskSimilarityViewComponent implements OnChanges {
@ViewChild(MatAccordion) accordion: MatAccordion;
panelOpenState = false;

constructor(private taskSimilarityService: TaskSimilarityService, private alertsService: AlertService) {}
constructor(
private taskSimilarityService: TaskSimilarityService,
private alertsService: AlertService,
private selectedTaskService: SelectedTaskService
) {}

ngOnChanges(changes: SimpleChanges) {
if (changes.task && changes.task.currentValue && this.task?.id) {
Expand All @@ -39,6 +43,7 @@ export class TaskSimilarityViewComponent implements OnChanges {
return s.flagged;
})
.reduce((a, b) => a || b, false);
this.selectedTaskService.checkFooterHeight();
});
}
}
15 changes: 9 additions & 6 deletions src/app/projects/states/dashboard/selected-task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,23 @@ export class SelectedTaskService {
return this.task$.value?.hasPdf;
}

public checkFooterHeight() {
if (this.task$.getValue()?.similaritiesDetected) {
this.globalState.showFooterWarning();
} else {
this.globalState.hideFooterWarning();
}
}

public setSelectedTask(task: number | Task) {
if (typeof task === 'number') {
this.taskService.get(task).subscribe(this.task$);
} else {
this.task$.next(task);

task?.getSubmissionDetails().subscribe();

if (task?.similaritiesDetected) {
this.globalState.showFooterWarning();
} else {
this.globalState.hideFooterWarning();
}
}
this.checkFooterHeight();
this.showSubmission();
}

Expand Down

0 comments on commit 19c43d7

Please sign in to comment.