通休編を自動挿入される通過にも適用されるように変更

This commit is contained in:
harukin-expo-dev-env
2025-09-24 16:14:35 +00:00
parent 3dbcc93448
commit 8702b22cdd
3 changed files with 14 additions and 10 deletions

View File

@@ -96,15 +96,17 @@ export const EachTrainInfoCore = ({
return StationNumbers;
});
useEffect(() => {
const stopStationList = trainData.map((i) => {
const isCancel = [];
const stopStationList = trainData.map((i,index,array) => {
const [station, se, time] = i.split(",");
const [nextStation, nextSe, nextTime] = array[index+1]?.split(",") || [];
isCancel.push(se.includes("休") && nextSe.includes("休"));
if (se == "通編") setHaveThrough(true);
return stationList.map((a) => a.filter((d) => d.StationName == station));
});
const allThroughStationList = stopStationList.map((i, index, array) => {
let allThroughStation = [];
if (index == array.length - 1) return;
const firstItem = array[index];
const secondItem = array[index + 1];
let betweenStationLine = "";
@@ -129,7 +131,8 @@ export const EachTrainInfoCore = ({
d.StationNumber > baseStationNumberFirst &&
d.StationNumber < baseStationNumberSecond
) {
allThroughStation.push(`${d.Station_JP},通過,`);
allThroughStation.push(`${d.Station_JP},${isCancel[index] ? "通休編" : "通過"},`);
setHaveThrough(true);
reverse = false;
} else {
@@ -137,7 +140,7 @@ export const EachTrainInfoCore = ({
d.StationNumber < baseStationNumberFirst &&
d.StationNumber > baseStationNumberSecond
) {
allThroughStation.push(`${d.Station_JP},通過,`);
allThroughStation.push(`${d.Station_JP},${isCancel[index] ? "通休編" : "通過"},`);
setHaveThrough(true);
reverse = true;
}