chore: lint

This commit is contained in:
dancingCycle 2024-02-15 22:20:27 +01:00
parent 787f525e0f
commit 9f1507e4de
4 changed files with 74 additions and 42 deletions

View File

@ -13,13 +13,17 @@ export default function Realtime({ state }) {
return (
<>
<p>
Show <b>GTFS Realtime TripUpdate</b>
Show
{' '}
entities that do<b>not</b>
<b>GTFS Realtime TripUpdate</b>
{' '}
match any<b>GTFS Schedule routes</b>
entities that do
<b>not</b>
{' '}
match any
<b>GTFS Schedule routes</b>
:
</p>
</p>
<OddRoutes />
</>
);
@ -27,13 +31,17 @@ export default function Realtime({ state }) {
return (
<>
<p>
Show <b>GTFS Realtime TripUpdate</b>
Show
{' '}
entities that do<b>not</b>
<b>GTFS Realtime TripUpdate</b>
{' '}
match any<b>GTFS Schedule trips</b>
entities that do
<b>not</b>
{' '}
match any
<b>GTFS Schedule trips</b>
:
</p>
</p>
<OddTrips />
</>
);
@ -41,14 +49,18 @@ export default function Realtime({ state }) {
return (
<>
<p>
Analyse <b>GTFS Realtime</b>
Analyse
{' '}
entities<b>TripUpdate</b>
<b>GTFS Realtime</b>
{' '}
on<b>feed</b>
entities
<b>TripUpdate</b>
{' '}
on
<b>feed</b>
{' '}
level:
</p>
</p>
<PerDay />
</>
);
@ -57,15 +69,15 @@ export default function Realtime({ state }) {
return (
<>
<p>
Analyse
{' '}
<b>GTFS Realtime</b>
Analyse
{' '}
<b>GTFS Realtime</b>
{' '}
entities
<b>TripUpdate</b>
<b>TripUpdate</b>
{' '}
on
<b>agencies</b>
<b>agencies</b>
{' '}
level:
</p>
@ -76,15 +88,15 @@ export default function Realtime({ state }) {
return (
<>
<p>
Analyse
{' '}
<b>GTFS Realtime</b>
Analyse
{' '}
<b>GTFS Realtime</b>
{' '}
entities
<b>TripUpdate</b>
<b>TripUpdate</b>
{' '}
on
<b>routes</b>
<b>routes</b>
{' '}
level:
</p>
@ -95,15 +107,15 @@ export default function Realtime({ state }) {
return (
<>
<p>
Analyse
{' '}
<b>GTFS Realtime</b>
Analyse
{' '}
<b>GTFS Realtime</b>
{' '}
entities
<b>TripUpdate</b>
<b>TripUpdate</b>
{' '}
on
<b>trips</b>
<b>trips</b>
{' '}
level:
</p>
@ -113,10 +125,11 @@ export default function Realtime({ state }) {
}
return (
<p>
Select a<b>GTFS Realtime</b>
Select a
<b>GTFS Realtime</b>
{' '}
analysis rule to contine!
</p>
</p>
);
}

View File

@ -116,10 +116,20 @@ export default function Overview() {
};
}, [agencies]);
/* this hook is run after a DOM update. Changing state might result in an infinite loop */
/* hook need to be placed in body of the function component in which it is used */
/*
this hook is run after a DOM update.
Changing state might result in an infinite loop
*/
/*
hook need to be placed in body of the function component in which it is used
*/
useEffect(() => {
/* declare let isMounted = true inside useEffect, which will be changed in the cleanup callback, as soon as the component is unmounted. Before state updates, check this variable conditionally. */
/*
declare let isMounted = true inside useEffect,
which will be changed in the cleanup callback,
as soon as the component is unmounted.
Before state updates, check this variable conditionally.
*/
let isMounted = true;
getAgencies(isMounted);
@ -127,8 +137,13 @@ export default function Overview() {
return () => {
isMounted = false;
};
/* use an empty dependency array to ensure the hook is running only once */
/* TODO study dependency array: https://reactjs.org/docs/hooks-effect.html */
/*
use an empty dependency array to ensure the hook is running only once
*/
/*
TODO study dependency array:
https://reactjs.org/docs/hooks-effect.html
*/
}, []);
return <OverviewTable overview={overview} />;

View File

@ -1,3 +1,4 @@
{ /* eslint-disable max-len */ }
function filterData(data, name, filter) {
if (data.length > 0) {
// console.log('filterData() data.length: '+data.length);
@ -5,7 +6,7 @@ function filterData(data, name, filter) {
// console.log('filterData() filter:'+filter);
switch (name) {
case 'agency':
return data.filter((item, index) => (
return data.filter((item) => (
(item.agency_id !== null && item.agency_id.toLowerCase().includes(filter.toLowerCase()))
|| item.agency_name.toLowerCase().includes(filter.toLowerCase())
|| item.agency_url.toLowerCase().includes(filter.toLowerCase())
@ -15,13 +16,13 @@ function filterData(data, name, filter) {
));
break;
case 'agency-id-name':
return data.filter((item, index) => (
return data.filter((item) => (
(item.agency_id !== null && item.agency_id.toLowerCase().includes(filter.toLowerCase()))
|| item.agency_name.toLowerCase().includes(filter.toLowerCase())
));
break;
case 'frequencies':
return data.filter((item, index) => (
return data.filter((item) => (
item.trip_id.toLowerCase().includes(filter.toLowerCase())
|| item.start_time.toLowerCase().includes(filter.toLowerCase())
|| item.end_time.toLowerCase().includes(filter.toLowerCase())
@ -30,7 +31,7 @@ function filterData(data, name, filter) {
));
break;
case 'routes':
return data.filter((item, index) => (
return data.filter((item) => (
item.route_id.toLowerCase().includes(filter.toLowerCase())
|| (item.agency_id !== null && item.agency_id.toLowerCase().includes(filter.toLowerCase()))
|| (item.route_short_name !== null && item.route_short_name.toLowerCase().includes(filter.toLowerCase()))
@ -42,7 +43,7 @@ function filterData(data, name, filter) {
));
break;
case 'shapes':
return data.filter((item, index) => (
return data.filter((item) => (
item.shape_id.toLowerCase().includes(filter.toLowerCase())
|| item.shape_pt_lat.toString().includes(filter)
|| item.shape_pt_lon.toString().includes(filter)
@ -50,7 +51,7 @@ function filterData(data, name, filter) {
));
break;
case 'stops':
return data.filter((item, index) => (item.stop_id.toString().includes(filter)
return data.filter((item) => (item.stop_id.toString().includes(filter)
|| (item.stop_code !== null && item.stop_code.toLowerCase().includes(filter.toLowerCase()))
|| (item.stop_name !== null && item.stop_name.toLowerCase().includes(filter.toLowerCase()))
|| (item.stop_desc !== null && item.stop_desc.toLowerCase().includes(filter.toLowerCase()))
@ -64,7 +65,7 @@ function filterData(data, name, filter) {
));
break;
case 'trips':
return data.filter((item, index) => (
return data.filter((item) => (
item.route_id.toLowerCase().includes(filter.toLowerCase())
|| item.service_id.toLowerCase().includes(filter.toLowerCase())
|| item.trip_id.toLowerCase().includes(filter.toLowerCase())
@ -84,6 +85,7 @@ function filterData(data, name, filter) {
return data;
}
}
{ /* eslint-enable max-len */ }
module.exports = {
filterData,
};

View File

@ -19,6 +19,7 @@ function getAryTripCount(res) {
// console.log('aryTripCount: ' + aryTripCount);
return aryTripCount;
}
return null;
}
/* provide http get service day response and get time array */
@ -26,12 +27,13 @@ function getAryTime(res) {
if (hasData(res)) {
const objService = res.data;
const aryService = Object.entries(objService);
const arrTime = aryService.map((trips, key) => {
const arrTime = aryService.map((trips) => {
const time = parseInt(trips[0], 10);
return time;
});
return arrTime;
}
return null;
}
module.exports = {