Skip to content

Commit

Permalink
정기 클래스 최종 날짜 데이터 계산 로직 변경
Browse files Browse the repository at this point in the history
정기 클래스 최종 날짜 데이터 계산 로직 변경
  • Loading branch information
hyeonjun-L authored Mar 13, 2024
2 parents 3805712 + 535efcb commit 5642687
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
2 changes: 0 additions & 2 deletions src/utils/apiDataProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,6 @@ export const classCreate = async (id: string) => {
}
})();

console.log('finalSchedules: ', finalSchedules);

const isLocationConfirmed = location?.address;

const { newGenres, etcGenres } = categorizeGenres(
Expand Down
25 changes: 17 additions & 8 deletions src/utils/scheduleDateUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,35 @@ export const calculateRegularFinalClass = (

const allDates = calculateUnSelectedDate(allDatesInRange, holidayDates);

return schedules.map((schedule) => {
const results: {
day: string[];
dateTime: string;
startDateTime: Date[];
}[] = [];

schedules.forEach((schedule) => {
const days = schedule.day.map((dayStr) => dayMapping[dayStr]);
const startDateTime: Date[] = [];

schedule.dateTime.forEach((time) => {
const startDateTime: Date[] = [];

allDates.forEach((date) => {
const day = getDay(date);

if (days.includes(day)) {
const newDate = makeNewDate(date, time);
startDateTime.push(newDate);
}
});
});

return {
...schedule,
startDateTime,
};
results.push({
day: schedule.day,
dateTime: time,
startDateTime,
});
});
});

return results;
};

export const getDatesFromSchedules = (
Expand Down

0 comments on commit 5642687

Please sign in to comment.