Skip to content
This repository was archived by the owner on Feb 9, 2025. It is now read-only.

Commit

Permalink
Merge pull request #168 from MaRcR11/167-if-edescription-===-etitle-o…
Browse files Browse the repository at this point in the history
…nly-display-one-of-them

fixed..
  • Loading branch information
MaRcR11 authored Nov 11, 2023
2 parents 67d00ef + 2f776ff commit bd7105e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions client/src/helpers/scheduleDataFormat.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { FormattedScheduleData, ScheduleData } from "../global/types";

const scheduleDataFormat = (scheduleData: ScheduleData[]): FormattedScheduleData[] =>
scheduleData.map((e) => ({
EndTime: new Date(e.end * 1000),
StartTime: new Date(e.start * 1000),
Subject: `${e.description.replace("VS", "")} (${e.title})`,
scheduleData.map(({ end, start, description, title, remarks, instructor, sroom }) => ({
EndTime: new Date(end * 1000),
StartTime: new Date(start * 1000),
Subject: description === title ? description.replace("VS", "") : `${description.replace("VS", "")} (${title})`,
Location:
e.remarks && !e.remarks.includes("Gruppe") && !e.remarks.includes("Prüfung")
? `${e.remarks} (${e.instructor})`
: `Berufsakademie ${e.remarks ? `(${e.remarks})` : ""} (${e.sroom ? e.sroom : "Raum unbekannt"}) (${
e.instructor
})`,
remarks && !remarks.includes("Gruppe") && !remarks.includes("Prüfung")
? `${remarks} (${instructor})`
: `Berufsakademie ${remarks ? `(${remarks})` : ""} (${sroom ? sroom : "Raum unbekannt"}) (${instructor})`,
}));

export default scheduleDataFormat;

0 comments on commit bd7105e

Please sign in to comment.