Skip to content

Commit

Permalink
fix Chaka and Sarah's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
clarani committed Jul 3, 2024
1 parent 746738b commit ac678a6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const SimulationResultsV2 = ({
setExtViewport={setExtViewport}
geometry={pathProperties?.geometry}
trainSimulation={
selectedTrain && selectedTrainRollingStock && trainSimulation
selectedTrain && trainSimulation
? {
...trainSimulation,
trainId: selectedTrain.id,
Expand Down
5 changes: 1 addition & 4 deletions front/src/common/Map/components/TrainOnMap/getTrainBody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,8 @@ const getTriangleSideDimensions = (zoomLengthFactor: number, size = 2) => {
down: 0.02,
};
const tail = {
left: 0.05,
right: 0.05,
...head,
up: 0.05,
upWidth: 0.019,
down: 0.02,
};
return {
head: mapValues(head, scaleNumber),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const useSpeedSpaceChart = (
return trainScheduleResult &&
rollingStock &&
formattedPowerRestrictions &&
simulation &&
simulation?.status === 'success' &&
formattedPathProperties &&
departureTime
? {
Expand Down
5 changes: 3 additions & 2 deletions front/src/modules/simulationResult/components/TimeButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState } from 'react';

import dayjs from 'dayjs';
import { useTranslation } from 'react-i18next';
import { FaBackward, FaPause, FaPlay, FaStop } from 'react-icons/fa';
import { useSelector } from 'react-redux';

import { convertDepartureTimeIntoSec } from 'applications/operationalStudies/utils';
import type { SimulationReport } from 'common/api/osrdEditoastApi';
import InputSNCF from 'common/BootstrapSNCF/InputSNCF';
import { updateIsPlaying } from 'reducers/osrdsimulation/actions';
Expand Down Expand Up @@ -58,7 +58,8 @@ const TimeButtons = ({ selectedTrain, departureTime }: TimeButtonsProps) => {
clearInterval(playInterval);
setPlayInterval(undefined);
if (trainScheduleV2Activated) {
if (departureTime) updateTimePositionV2(dayjs(departureTime, 'D/MM/YYYY HH:mm:ss').toDate());
if (departureTime)
updateTimePositionV2(sec2datetime(convertDepartureTimeIntoSec(departureTime)));
} else if (selectedTrain) {
updateTimePosition(sec2datetime(selectedTrain.base.stops[0].time));
}
Expand Down
2 changes: 1 addition & 1 deletion front/src/utils/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const formatDateToString = (date: Date) => {

/** check whether a date is included in the range or not */
export function dateIsInRange(date: Date, range: [Date, Date]) {
return date > range[0] && date < range[1];
return range[0] <= date && date <= range[1];
}

export const formatDateForInput = (date?: string | null) => (date ? date.substring(0, 10) : '');
Expand Down

0 comments on commit ac678a6

Please sign in to comment.