Skip to content

Commit

Permalink
Merge pull request #127 from satikaj/add-numbas-integration
Browse files Browse the repository at this point in the history
Merge add-tii-integration into add-numbas-integration
  • Loading branch information
maddernd authored Dec 5, 2023
2 parents 61bb7e8 + 32fcbcd commit fb31f77
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/app/api/models/user/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Entity, EntityMapping } from 'ngx-entity-service';
import { Observable, map } from 'rxjs';
import { AppInjector } from 'src/app/app-injector';
import { DoubtfireConstants } from 'src/app/config/constants/doubtfire-constants';
import { AuthenticationService } from '../doubtfire-model';

export type Tutor = User;

Expand Down Expand Up @@ -59,6 +60,10 @@ export class User extends Entity {
public acceptTiiEula(): Observable<boolean> {
const httpClient = AppInjector.get(HttpClient);
const uri = `${AppInjector.get(DoubtfireConstants).API_URL}/tii_eula/users/${this.id}/accept`;
return httpClient.put(uri, {}).pipe(map(() => (this.acceptedTiiEula = true)));
return httpClient.put(uri, {}).pipe(map(() => {
this.acceptedTiiEula = true;
AppInjector.get(AuthenticationService).saveCurrentUser();
return true;
}));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { FileDownloaderService } from 'src/app/common/file-downloader/file-downl
templateUrl: './task-submission-card.component.html',
styleUrls: ['./task-submission-card.component.scss'],
})
export class TaskSubmissionCardComponent implements OnChanges {
export class TaskSubmissionCardComponent implements OnChanges, OnInit {
@Input() task: Task;
canReuploadEvidence: boolean;
canRegeneratePdf: boolean;
submission: { isProcessing: boolean; isUploaded: boolean };
submission: { isProcessing: boolean; isUploaded: boolean } = { isProcessing: false, isUploaded: false };
urls: { pdf: string; files: string };

constructor(
Expand All @@ -23,6 +23,12 @@ export class TaskSubmissionCardComponent implements OnChanges {
private fileDownloader: FileDownloaderService
) {}

ngOnInit(): void {
if (this.task) {
this.reapplySubmissionData();
}
}

ngOnChanges(changes: SimpleChanges): void {
if (changes.task) {
this.reapplySubmissionData();
Expand Down
1 change: 0 additions & 1 deletion src/app/sessions/transition-hooks.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export class TransitionHooksService {
if ( this.tiiEnabled &&
!this.userService.isAnonymousUser() &&
userService.currentUser.hasRunFirstTimeSetup &&
userService.currentUser.isStaff &&
!userService.currentUser.acceptedTiiEula &&
toState !== 'eula'
) {
Expand Down

0 comments on commit fb31f77

Please sign in to comment.