Skip to content

Commit

Permalink
Use constants for course status IDs in getEventState #471
Browse files Browse the repository at this point in the history
  • Loading branch information
hupf committed Nov 21, 2022
1 parent 9af6875 commit 9cd496a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/app/events/utils/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ export type EventStateWithLabel = {
label?: string;
};

const INTERMEDIATE_RATING_STATUS_ID = 10300;
const DEFINITIVELY_EVALUATED_STATUS_ID = 10260;
const CAS_ACTIVE_STATUS_ID = 14030;
const COURSE_ACTIVE_STATUS_ID = 10350;

/**
* Returns the event state with an optional label based on the given
* course's evaluation and test status. See #427
Expand All @@ -20,7 +25,8 @@ export function getEventState(course: Course): Option<EventStateWithLabel> {

if (
HasEvaluationStarted === true &&
(course.StatusId === 14030 || course.StatusId === 10350)
(course.StatusId === CAS_ACTIVE_STATUS_ID ||
course.StatusId === COURSE_ACTIVE_STATUS_ID)
) {
// Bewertung
return {
Expand All @@ -34,7 +40,7 @@ export function getEventState(course: Course): Option<EventStateWithLabel> {
return {
value: EventState.RatingUntil,
};
} else if (course.StatusId === 10300) {
} else if (course.StatusId === INTERMEDIATE_RATING_STATUS_ID) {
// Zwischenbewertung
return {
value: EventState.IntermediateRating,
Expand All @@ -46,7 +52,7 @@ export function getEventState(course: Course): Option<EventStateWithLabel> {
HasEvaluationStarted === false &&
HasTestGrading === true &&
HasReviewOfEvaluationStarted === false &&
course.StatusId !== 10260
course.StatusId !== DEFINITIVELY_EVALUATED_STATUS_ID
) {
// Tests erfassen
return {
Expand Down

0 comments on commit 9cd496a

Please sign in to comment.