Skip to content

Commit

Permalink
Add Application Date Start / End Editor for Terms (#644)
Browse files Browse the repository at this point in the history
* Prepare TA Applications for Spring 2025

* Fix Another Date Field

* Add Application Start / End Editing
  • Loading branch information
ajaygandecha authored Nov 11, 2024
1 parent 1b38e36 commit e9f9d3d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
2 changes: 2 additions & 0 deletions backend/services/academics/term.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ def update(self, subject: User, term: Term) -> TermDetails:
term_entity.name = term.name
term_entity.start = term.start
term_entity.end = term.end
term_entity.applications_open = term.applications_open
term_entity.applications_close = term.applications_close

# Commit changes
self._session.commit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
</mat-form-field>
<!-- Term Start Field -->
<mat-form-field appearance="outline" color="accent">
<mat-label>Term Start Date</mat-label>
<input
matInput
type="datetime-local"
Expand All @@ -46,6 +47,7 @@
</mat-form-field>
<!-- Term End Field -->
<mat-form-field appearance="outline" color="accent">
<mat-label>Term End Date</mat-label>
<input
matInput
type="datetime-local"
Expand All @@ -54,6 +56,28 @@
name="end"
required />
</mat-form-field>
<!-- Term Applications Open Field -->
<mat-form-field appearance="outline" color="accent">
<mat-label>Term Applications Open Date</mat-label>
<input
matInput
type="datetime-local"
placeholder="Start Date"
formControlName="applications_open"
name="applications_open"
required />
</mat-form-field>
<!-- Term Applications Close Field -->
<mat-form-field appearance="outline" color="accent">
<mat-label>Term Applications Close Date</mat-label>
<input
matInput
type="datetime-local"
placeholder="End Date"
formControlName="applications_close"
name="applications_close"
required />
</mat-form-field>
</mat-card-content>
<mat-card-actions>
<button mat-stroked-button routerLink="/academics/admin/term">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,17 @@ export class TermEditorComponent {
name = new FormControl('', [Validators.required]);
start = new FormControl('', [Validators.required]);
end = new FormControl('', [Validators.required]);
applications_open = new FormControl('', [Validators.required]);
applications_close = new FormControl('', [Validators.required]);

/** Term Editor Form */
public termForm = this.formBuilder.group({
id: this.id,
name: this.name,
start: this.start,
end: this.end
end: this.end,
applications_open: this.applications_open,
applications_close: this.applications_close
});

/** Constructs the term editor component */
Expand Down Expand Up @@ -111,7 +115,15 @@ export class TermEditorComponent {
id: this.termId == 'new' ? '' : this.term.id,
name: this.term.name,
start: this.datePipe.transform(this.term.start, 'yyyy-MM-ddTHH:mm'),
end: this.datePipe.transform(this.term.end, 'yyyy-MM-ddTHH:mm')
end: this.datePipe.transform(this.term.end, 'yyyy-MM-ddTHH:mm'),
applications_open: this.datePipe.transform(
this.term.applications_open,
'yyyy-MM-ddTHH:mm'
),
applications_close: this.datePipe.transform(
this.term.applications_close,
'yyyy-MM-ddTHH:mm'
)
});
}

Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/academics/academics.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export interface EditedSection {
export interface Term extends TimeRange {
id: string;
name: string;
applications_open: Date;
applications_close: Date;
}

/** Defines a Section Member */
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/academics/academics.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export const termResolver: ResolveFn<Term | undefined> = (route, state) => {
name: '',
start: new Date(),
end: new Date(),
applications_open: new Date(),
applications_close: new Date(),
course_sections: null
};
}
Expand Down

0 comments on commit e9f9d3d

Please sign in to comment.