Skip to content

Commit

Permalink
fix: show delete and download buttons in editor when Numbas test exists
Browse files Browse the repository at this point in the history
  • Loading branch information
satikaj committed Mar 22, 2024
1 parent 96286c0 commit a09a039
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/app/api/models/task-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class TaskDefinition extends Entity {
hasTaskSheet: boolean;
hasTaskResources: boolean;
hasEnabledNumbasTest: boolean;
hasUploadedNumbasTest: boolean;
hasNumbasData: boolean;
hasUnlimitedRetriesForNumbas: boolean;
hasTimeDelayForNumbas: boolean;
isNumbasRestrictedTo1Attempt: boolean;
Expand Down Expand Up @@ -217,7 +217,7 @@ export class TaskDefinition extends Entity {

public deleteNumbasTest(): Observable<any> {
const httpClient = AppInjector.get(HttpClient);
return httpClient.delete(this.numbasTestUploadUrl).pipe(tap(() => (this.hasUploadedNumbasTest = false)));
return httpClient.delete(this.numbasTestUploadUrl).pipe(tap(() => (this.hasNumbasData = false)));
}

public deleteTaskAssessmentResources(): Observable<any> {
Expand Down
4 changes: 2 additions & 2 deletions src/app/api/services/task-definition.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class TaskDefinitionService extends CachedEntityService<TaskDefinition> {
'hasTaskResources',
'hasTaskAssessmentResources',
'hasEnabledNumbasTest',
'hasUploadedNumbasTest',
'hasNumbasData',
'hasUnlimitedRetriesForNumbas',
'hasTimeDelayForNumbas',
'isNumbasRestrictedTo1Attempt',
Expand All @@ -121,7 +121,7 @@ export class TaskDefinitionService extends CachedEntityService<TaskDefinition> {
'hasTaskSheet',
'hasTaskResources',
'hasTaskAssessmentResources',
'hasUploadedNumbasTest'
'hasNumbasData'
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
accept="application/zip"
[desiredFileName]="'Numbas zip'"
/>
@if (taskDefinition.hasUploadedNumbasTest) {
@if (taskDefinition.hasNumbasData) {
<div class="flex flex-row gap-4 pt-4">
<button mat-flat-button color="warn" (click)="removeNumbasTest()" class="flex-grow me-4">
Delete Numbas Zip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export class TaskDefinitionNumbasComponent {
next: () => this.alerts.add('success', 'Uploaded Numbas test data', 2000),
error: (message) => this.alerts.add('danger', message, 6000),
});
this.taskDefinition.hasUploadedNumbasTest = true;
} else {
this.alerts.add('danger', 'Please drop a zip file to upload Numbas test data for this task', 6000);
}
Expand Down

0 comments on commit a09a039

Please sign in to comment.