Skip to content

Commit

Permalink
fix naming in useOccurrences
Browse files Browse the repository at this point in the history
  • Loading branch information
SharglutDev committed Mar 7, 2025
1 parent 42c86a8 commit 7e8ff62
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import dayjs from 'dayjs';

import type { OccurrenceId } from 'reducers/osrdconf/types';

import type { Occurrence, PacedTrainWithResult } from '../../types';
import type { Occurrence, PacedTrainWithDetails } from '../../types';

export const computeOccurrenceName = (pacedTrainName: string, index: number): string => {
const endByNumber = /\b\w+\s\d+$/;
Expand All @@ -29,9 +29,9 @@ const useOccurrences = ({
paced,
startTime,
arrivalTime,
trainName,
name,
rollingStock,
}: PacedTrainWithResult) => {
}: PacedTrainWithDetails) => {
const occurrencesState = useMemo<OccurrencesState>(() => {
const occurrencesCount = Math.ceil(paced.duration.ms / paced.step.ms);
const computedOccurrences: Occurrence[] = [];
Expand All @@ -45,14 +45,14 @@ const useOccurrences = ({
.toDate();
computedOccurrences.push({
id: `occurrence-${i}-${id}` as OccurrenceId,
trainName: computeOccurrenceName(trainName, i),
trainName: computeOccurrenceName(name, i),
rollingStock,
startTime: occurrenceStartTime,
arrivalTime: occurrenceArrivalTime,
});
}
return { occurrencesCount, occurrences: computedOccurrences };
}, [paced.duration, paced.step, startTime, arrivalTime, trainName, id, rollingStock]);
}, [paced.duration, paced.step, startTime, arrivalTime, name, id, rollingStock]);

return occurrencesState;
};
Expand Down

0 comments on commit 7e8ff62

Please sign in to comment.