chore: refactor

This commit is contained in:
dancingCycle 2023-08-29 08:36:19 +02:00
parent a9337771a7
commit f4c228924d
3 changed files with 145 additions and 1020 deletions

View File

@ -0,0 +1,61 @@
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import {Link} from 'react-router-dom';
import {
getGtfsStopsCountDeState,
getGtfsStopsCountNotGiDeState
} from '../utils/api';
/*destructure props object*/
export default function State ({state}) {
const [countStops, setCountStops] = useState('loading...');
const [countStopsNotDhid, setCountStopsNotDhid] = useState('loading...');
const fetchStops = async () => {
let count=await getGtfsStopsCountDeState(state)
if(count > -1){
setCountStops(count);
}
};
const fetchStopsNotDhid = async () => {
let count=await getGtfsStopsCountNotGiDeState(state);
if(count > -1){
setCountStopsNotDhid(count);
}
};
useEffect(() => {
/*effect goes here*/
fetchStops();
fetchStopsNotDhid();
/*use an empty dependency countStopsGtfs to ensure the hook is running only once*/
/*TODO study dependency countStopsGtfs: https://reactjs.org/docs/hooks-effect.html*/
}, []);
if (state !== undefined || state !== null || state === '') {
/*return a React element*/
return (
<>
<p>
DE-{state.toUpperCase()}: Stops not compliant with the Global ID:&nbsp;
{countStopsNotDhid} ({countStops !== 0 ? (countStopsNotDhid / countStops * 100).toFixed(3) : 'loading...'} %)
(Stops overall:&nbsp;
{countStops})
</p>
</>
);
}else{
return (
<>
<p>Loading...</p>
</>
);
}
};
State.propTypes = {
state: PropTypes.string
};

View File

@ -1,84 +1,20 @@
import React, { useState, useEffect } from 'react'
import {Link} from 'react-router-dom';
import State from '../components/state';
import {
getStopsCountGtfsDeNotDhid,
getStopsCountGtfsDeHbNotDhid,
getStopsCountGtfsDeHhNotDhid,
getStopsCountGtfsDeNiNotDhid,
getStopsCountGtfsDeShNotDhid,
getStopsCountGtfsDeMvNotDhid,
getStopsCountGtfsDeBbNotDhid,
getStopsCountGtfsDeBeNotDhid,
getStopsCountGtfsDeStNotDhid,
getStopsCountGtfsDeNwNotDhid,
getStopsCountGtfsDeHeNotDhid,
getStopsCountGtfsDeSnNotDhid,
getStopsCountGtfsDeThNotDhid,
getStopsCountGtfsDeRpNotDhid,
getStopsCountGtfsDeSlNotDhid,
getStopsCountGtfsDeByNotDhid,
getStopsCountGtfsDeBwNotDhid,
getStopsCountGtfs,
getStopsCountGtfsLt0,
getStopsCountGtfsDe,
getStopsCountGtfsDeHb,
getStopsCountGtfsDeHh,
getStopsCountGtfsDeNi,
getStopsCountGtfsDeSh,
getStopsCountGtfsDeMv,
getStopsCountGtfsDeBb,
getStopsCountGtfsDeBe,
getStopsCountGtfsDeSt,
getStopsCountGtfsDeNw,
getStopsCountGtfsDeHe,
getStopsCountGtfsDeSn,
getStopsCountGtfsDeTh,
getStopsCountGtfsDeRp,
getStopsCountGtfsDeSl,
getStopsCountGtfsDeBy,
getStopsCountGtfsDeBw
getStopsCountGtfsDeNotDhid,
getStopsCountGtfsLt0
} from '../utils/api';
export default function Home(){
const [countStopsGtfs, setCountStopsGtfs] = useState('loading...');
const [countStopsGtfsDe, setCountStopsGtfsDe] = useState('loading...');
const [countStopsGtfsLt0, setCountStopsGtfsLt0] = useState('loading...');
const [countStopsGtfsDeHb, setCountStopsGtfsDeHb] = useState('loading...');
const [countStopsGtfsDeHh, setCountStopsGtfsDeHh] = useState('loading...');
const [countStopsGtfsDeNi, setCountStopsGtfsDeNi] = useState('loading...');
const [countStopsGtfsDeSh, setCountStopsGtfsDeSh] = useState('loading...');
const [countStopsGtfsDeMv, setCountStopsGtfsDeMv] = useState('loading...');
const [countStopsGtfsDeBb, setCountStopsGtfsDeBb] = useState('loading...');
const [countStopsGtfsDeBe, setCountStopsGtfsDeBe] = useState('loading...');
const [countStopsGtfsDeSt, setCountStopsGtfsDeSt] = useState('loading...');
const [countStopsGtfsDeNw, setCountStopsGtfsDeNw] = useState('loading...');
const [countStopsGtfsDeHe, setCountStopsGtfsDeHe] = useState('loading...');
const [countStopsGtfsDeSn, setCountStopsGtfsDeSn] = useState('loading...');
const [countStopsGtfsDeTh, setCountStopsGtfsDeTh] = useState('loading...');
const [countStopsGtfsDeRp, setCountStopsGtfsDeRp] = useState('loading...');
const [countStopsGtfsDeSl, setCountStopsGtfsDeSl] = useState('loading...');
const [countStopsGtfsDeBy, setCountStopsGtfsDeBy] = useState('loading...');
const [countStopsGtfsDeBw, setCountStopsGtfsDeBw] = useState('loading...');
const [countStopsGtfsDe, setCountStopsGtfsDe] = useState('loading...');
const [countStopsGtfsDeNotDhid, setCountStopsGtfsDeNotDhid] = useState('loading...');
const [countStopsGtfsDeHbNotDhid, setCountStopsGtfsDeHbNotDhid] = useState('loading...');
const [countStopsGtfsDeHhNotDhid, setCountStopsGtfsDeHhNotDhid] = useState('loading...');
const [countStopsGtfsDeNiNotDhid, setCountStopsGtfsDeNiNotDhid] = useState('loading...');
const [countStopsGtfsDeShNotDhid, setCountStopsGtfsDeShNotDhid] = useState('loading...');
const [countStopsGtfsDeMvNotDhid, setCountStopsGtfsDeMvNotDhid] = useState('loading...');
const [countStopsGtfsDeBbNotDhid, setCountStopsGtfsDeBbNotDhid] = useState('loading...');
const [countStopsGtfsDeBeNotDhid, setCountStopsGtfsDeBeNotDhid] = useState('loading...');
const [countStopsGtfsDeStNotDhid, setCountStopsGtfsDeStNotDhid] = useState('loading...');
const [countStopsGtfsDeNwNotDhid, setCountStopsGtfsDeNwNotDhid] = useState('loading...');
const [countStopsGtfsDeHeNotDhid, setCountStopsGtfsDeHeNotDhid] = useState('loading...');
const [countStopsGtfsDeSnNotDhid, setCountStopsGtfsDeSnNotDhid] = useState('loading...');
const [countStopsGtfsDeThNotDhid, setCountStopsGtfsDeThNotDhid] = useState('loading...');
const [countStopsGtfsDeRpNotDhid, setCountStopsGtfsDeRpNotDhid] = useState('loading...');
const [countStopsGtfsDeSlNotDhid, setCountStopsGtfsDeSlNotDhid] = useState('loading...');
const [countStopsGtfsDeByNotDhid, setCountStopsGtfsDeByNotDhid] = useState('loading...');
const [countStopsGtfsDeBwNotDhid, setCountStopsGtfsDeBwNotDhid] = useState('loading...');
const fetchGtfs = async () => {
let count=await getStopsCountGtfs();
@ -87,20 +23,6 @@ export default function Home(){
}
};
const fetchGtfsDe = async () => {
let count=await getStopsCountGtfsDe();
if(count > -1){
setCountStopsGtfsDe((countStopsGtfsDe) => count);
}
};
const fetchGtfsDeHb = async () => {
let count=await getStopsCountGtfsDeHb();
if(count > -1){
setCountStopsGtfsDeHb((countStopsGtfsDeHb) => count);
}
};
const fetchGtfsLt0 = async () => {
let count=await getStopsCountGtfsLt0();
if(count > -1){
@ -108,17 +30,10 @@ export default function Home(){
}
};
const fetchGtfsDeHh = async () => {
let count=await getStopsCountGtfsDeHh();
const fetchGtfsDe = async () => {
let count=await getStopsCountGtfsDe();
if(count > -1){
setCountStopsGtfsDeHh((countStopsGtfsDeHh) => count);
}
};
const fetchGtfsDeNi = async () => {
let count=await getStopsCountGtfsDeNi();
if(count > -1){
setCountStopsGtfsDeNi((countStopsGtfsDeNi) => count);
setCountStopsGtfsDe((countStopsGtfsDe) => count);
}
};
@ -129,249 +44,12 @@ export default function Home(){
}
};
const fetchGtfsDeHbNotDhid = async () => {
let count=await getStopsCountGtfsDeHbNotDhid();
if(count > -1){
setCountStopsGtfsDeHbNotDhid((countStopsGtfsDeHbNotDhid) => count);
}
};
const fetchGtfsDeHhNotDhid = async () => {
let count=await getStopsCountGtfsDeHhNotDhid();
if(count > -1){
setCountStopsGtfsDeHhNotDhid((countStopsGtfsDeHhNotDhid) => count);
}
};
const fetchGtfsDeNiNotDhid = async () => {
let count=await getStopsCountGtfsDeNiNotDhid();
if(count > -1){
setCountStopsGtfsDeNiNotDhid(count);
}
};
const fetchGtfsDeShNotDhid = async () => {
let count=await getStopsCountGtfsDeShNotDhid();
if(count > -1){
setCountStopsGtfsDeShNotDhid(count);
}
};
const fetchGtfsDeSh = async () => {
let count=await getStopsCountGtfsDeSh();
if(count > -1){
setCountStopsGtfsDeSh(count);
}
};
const fetchGtfsDeMvNotDhid = async () => {
let count=await getStopsCountGtfsDeMvNotDhid();
if(count > -1){
setCountStopsGtfsDeMvNotDhid(count);
}
};
const fetchGtfsDeMv = async () => {
let count=await getStopsCountGtfsDeMv();
if(count > -1){
setCountStopsGtfsDeMv(count);
}
};
const fetchGtfsDeBbNotDhid = async () => {
let count=await getStopsCountGtfsDeBbNotDhid();
if(count > -1){
setCountStopsGtfsDeBbNotDhid(count);
}
};
const fetchGtfsDeBb = async () => {
let count=await getStopsCountGtfsDeBb();
if(count > -1){
setCountStopsGtfsDeBb(count);
}
};
const fetchGtfsDeBeNotDhid = async () => {
let count=await getStopsCountGtfsDeBeNotDhid();
if(count > -1){
setCountStopsGtfsDeBeNotDhid(count);
}
};
const fetchGtfsDeBe = async () => {
let count=await getStopsCountGtfsDeBe();
if(count > -1){
setCountStopsGtfsDeBe(count);
}
};
const fetchGtfsDeStNotDhid = async () => {
let count=await getStopsCountGtfsDeStNotDhid();
if(count > -1){
setCountStopsGtfsDeStNotDhid(count);
}
};
const fetchGtfsDeSt = async () => {
let count=await getStopsCountGtfsDeSt();
if(count > -1){
setCountStopsGtfsDeSt(count);
}
};
const fetchGtfsDeNwNotDhid = async () => {
let count=await getStopsCountGtfsDeNwNotDhid();
if(count > -1){
setCountStopsGtfsDeNwNotDhid(count);
}
};
const fetchGtfsDeNw = async () => {
let count=await getStopsCountGtfsDeNw();
if(count > -1){
setCountStopsGtfsDeNw(count);
}
};
const fetchGtfsDeHeNotDhid = async () => {
let count=await getStopsCountGtfsDeHeNotDhid();
if(count > -1){
setCountStopsGtfsDeHeNotDhid(count);
}
};
const fetchGtfsDeHe = async () => {
let count=await getStopsCountGtfsDeHe();
if(count > -1){
setCountStopsGtfsDeHe(count);
}
};
const fetchGtfsDeSnNotDhid = async () => {
let count=await getStopsCountGtfsDeSnNotDhid();
if(count > -1){
setCountStopsGtfsDeSnNotDhid(count);
}
};
const fetchGtfsDeSn = async () => {
let count=await getStopsCountGtfsDeSn();
if(count > -1){
setCountStopsGtfsDeSn(count);
}
};
const fetchGtfsDeThNotDhid = async () => {
let count=await getStopsCountGtfsDeThNotDhid();
if(count > -1){
setCountStopsGtfsDeThNotDhid(count);
}
};
const fetchGtfsDeTh = async () => {
let count=await getStopsCountGtfsDeTh();
if(count > -1){
setCountStopsGtfsDeTh(count);
}
};
const fetchGtfsDeRpNotDhid = async () => {
let count=await getStopsCountGtfsDeRpNotDhid();
if(count > -1){
setCountStopsGtfsDeRpNotDhid(count);
}
};
const fetchGtfsDeRp = async () => {
let count=await getStopsCountGtfsDeRp();
if(count > -1){
setCountStopsGtfsDeRp(count);
}
};
const fetchGtfsDeSlNotDhid = async () => {
let count=await getStopsCountGtfsDeSlNotDhid();
if(count > -1){
setCountStopsGtfsDeSlNotDhid(count);
}
};
const fetchGtfsDeSl = async () => {
let count=await getStopsCountGtfsDeSl();
if(count > -1){
setCountStopsGtfsDeSl(count);
}
};
const fetchGtfsDeByNotDhid = async () => {
let count=await getStopsCountGtfsDeByNotDhid();
if(count > -1){
setCountStopsGtfsDeByNotDhid(count);
}
};
const fetchGtfsDeBy = async () => {
let count=await getStopsCountGtfsDeBy();
if(count > -1){
setCountStopsGtfsDeBy(count);
}
};
const fetchGtfsDeBwNotDhid = async () => {
let count=await getStopsCountGtfsDeBwNotDhid();
if(count > -1){
setCountStopsGtfsDeBwNotDhid(count);
}
};
const fetchGtfsDeBw = async () => {
let count=await getStopsCountGtfsDeBw();
if(count > -1){
setCountStopsGtfsDeBw(count);
}
};
useEffect(() => {
/*effect goes here*/
fetchGtfs();
fetchGtfsDe();
fetchGtfsLt0();
fetchGtfsDeHb();
fetchGtfsDeHh();
fetchGtfsDeNi();
fetchGtfsDeSh();
fetchGtfsDeMv();
fetchGtfsDeBb();
fetchGtfsDeBe();
fetchGtfsDeSt();
fetchGtfsDeNw();
fetchGtfsDeHe();
fetchGtfsDeSn();
fetchGtfsDeTh();
fetchGtfsDeRp();
fetchGtfsDeSl();
fetchGtfsDeBy();
fetchGtfsDeBw();
fetchGtfsDe();
fetchGtfsDeNotDhid();
fetchGtfsDeHbNotDhid();
fetchGtfsDeHhNotDhid();
fetchGtfsDeNiNotDhid();
fetchGtfsDeShNotDhid();
fetchGtfsDeMvNotDhid();
fetchGtfsDeBbNotDhid();
fetchGtfsDeBeNotDhid();
fetchGtfsDeStNotDhid();
fetchGtfsDeNwNotDhid();
fetchGtfsDeHeNotDhid();
fetchGtfsDeSnNotDhid();
fetchGtfsDeThNotDhid();
fetchGtfsDeRpNotDhid();
fetchGtfsDeSlNotDhid();
fetchGtfsDeByNotDhid();
fetchGtfsDeBwNotDhid();
/*use an empty dependency countStopsGtfs to ensure the hook is running only once*/
/*TODO study dependency countStopsGtfs: https://reactjs.org/docs/hooks-effect.html*/
}, []);
@ -396,141 +74,27 @@ export default function Home(){
{countStopsGtfsLt0}
</p>
<p>
Number of stops inside DE:&nbsp;
{countStopsGtfsDe}
</p>
<p>
Number of stops inside DE not compliant with the Global ID:&nbsp;
DE: Stops not compliant with the Global ID:&nbsp;
{countStopsGtfsDeNotDhid} ({countStopsGtfsDe !== 0 ? (countStopsGtfsDeNotDhid / countStopsGtfsDe * 100).toFixed(3) : 'loading...'} %)
(Stops overall:&nbsp;
{countStopsGtfsDe})
</p>
<p>
Number of stops inside DE-HB:&nbsp;
{countStopsGtfsDeHb}
</p>
<p>
Number of stops inside DE-HB not compliant with the Global ID:&nbsp;
{countStopsGtfsDeHbNotDhid} ({countStopsGtfsDeHb !== 0 ? (countStopsGtfsDeHbNotDhid / countStopsGtfsDeHb * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-HH:&nbsp;
{countStopsGtfsDeHh}
</p>
<p>
Number of stops inside DE-HH not compliant with the Global ID:&nbsp;
{countStopsGtfsDeHhNotDhid} ({countStopsGtfsDeHh !== 0 ? (countStopsGtfsDeHhNotDhid / countStopsGtfsDeHh * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-NI:&nbsp;
{countStopsGtfsDeNi}
</p>
<p>
Number of stops inside DE-NI not compliant with the Global ID:&nbsp;
{countStopsGtfsDeNiNotDhid} ({countStopsGtfsDeNi !== 0 ? (countStopsGtfsDeNiNotDhid / countStopsGtfsDeNi * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-SH:&nbsp;
{countStopsGtfsDeSh}
</p>
<p>
Number of stops inside DE-SH not compliant with the Global ID:&nbsp;
{countStopsGtfsDeShNotDhid} ({countStopsGtfsDeSh !== 0 ? (countStopsGtfsDeShNotDhid / countStopsGtfsDeSh * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-MV:&nbsp;
{countStopsGtfsDeMv}
</p>
<p>
Number of stops inside DE-MV not compliant with the Global ID:&nbsp;
{countStopsGtfsDeMvNotDhid} ({countStopsGtfsDeMv !== 0 ? (countStopsGtfsDeMvNotDhid / countStopsGtfsDeMv * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-BB:&nbsp;
{countStopsGtfsDeBb}
</p>
<p>
Number of stops inside DE-BB not compliant with the Global ID:&nbsp;
{countStopsGtfsDeBbNotDhid} ({countStopsGtfsDeBb !== 0 ? (countStopsGtfsDeBbNotDhid / countStopsGtfsDeBb * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-BE:&nbsp;
{countStopsGtfsDeBe}
</p>
<p>
Number of stops inside DE-BE not compliant with the Global ID:&nbsp;
{countStopsGtfsDeBeNotDhid} ({countStopsGtfsDeBe !== 0 ? (countStopsGtfsDeBeNotDhid / countStopsGtfsDeBe * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-ST:&nbsp;
{countStopsGtfsDeSt}
</p>
<p>
Number of stops inside DE-ST not compliant with the Global ID:&nbsp;
{countStopsGtfsDeStNotDhid} ({countStopsGtfsDeSt !== 0 ? (countStopsGtfsDeStNotDhid / countStopsGtfsDeSt * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-NW:&nbsp;
{countStopsGtfsDeNw}
</p>
<p>
Number of stops inside DE-NW not compliant with the Global ID:&nbsp;
{countStopsGtfsDeNwNotDhid} ({countStopsGtfsDeNw !== 0 ? (countStopsGtfsDeNwNotDhid / countStopsGtfsDeNw * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-HE:&nbsp;
{countStopsGtfsDeHe}
</p>
<p>
Number of stops inside DE-HE not compliant with the Global ID:&nbsp;
{countStopsGtfsDeHeNotDhid} ({countStopsGtfsDeHe !== 0 ? (countStopsGtfsDeHeNotDhid / countStopsGtfsDeHe * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-SN:&nbsp;
{countStopsGtfsDeSn}
</p>
<p>
Number of stops inside DE-SN not compliant with the Global ID:&nbsp;
{countStopsGtfsDeSnNotDhid} ({countStopsGtfsDeSn !== 0 ? (countStopsGtfsDeSnNotDhid / countStopsGtfsDeSn * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-TH:&nbsp;
{countStopsGtfsDeTh}
</p>
<p>
Number of stops inside DE-TH not compliant with the Global ID:&nbsp;
{countStopsGtfsDeThNotDhid} ({countStopsGtfsDeTh !== 0 ? (countStopsGtfsDeThNotDhid / countStopsGtfsDeTh * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-RP:&nbsp;
{countStopsGtfsDeRp}
</p>
<p>
Number of stops inside DE-RP not compliant with the Global ID:&nbsp;
{countStopsGtfsDeRpNotDhid} ({countStopsGtfsDeRp !== 0 ? (countStopsGtfsDeRpNotDhid / countStopsGtfsDeRp * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-SL:&nbsp;
{countStopsGtfsDeSl}
</p>
<p>
Number of stops inside DE-SL not compliant with the Global ID:&nbsp;
{countStopsGtfsDeSlNotDhid} ({countStopsGtfsDeSl !== 0 ? (countStopsGtfsDeSlNotDhid / countStopsGtfsDeSl * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-BY:&nbsp;
{countStopsGtfsDeBy}
</p>
<p>
Number of stops inside DE-BY not compliant with the Global ID:&nbsp;
{countStopsGtfsDeByNotDhid} ({countStopsGtfsDeBy !== 0 ? (countStopsGtfsDeByNotDhid / countStopsGtfsDeBy * 100).toFixed(3) : 'loading...'} %)
</p>
<p>
Number of stops inside DE-BW:&nbsp;
{countStopsGtfsDeBw}
</p>
<p>
Number of stops inside DE-BW not compliant with the Global ID:&nbsp;
{countStopsGtfsDeBwNotDhid} ({countStopsGtfsDeBw !== 0 ? (countStopsGtfsDeBwNotDhid / countStopsGtfsDeBw * 100).toFixed(3) : 'loading...'} %)
</p>
<State state='bb' />
<State state='be' />
<State state='by' />
<State state='bw' />
<State state='hb' />
<State state='he' />
<State state='hh' />
<State state='mv' />
<State state='ni' />
<State state='nw' />
<State state='rp' />
<State state='sh' />
<State state='sl' />
<State state='sn' />
<State state='st' />
<State state='th' />
<h3>
<Link to="/stops-non-compliant">
Browse through stops inside DE not compliant with the Global ID.

View File

@ -3,7 +3,7 @@ import axios from 'axios';
import config from './config';
export async function getStopsCountGtfs(){
//console.log('api:getStopsCountGtfs() Start...');
////console.log('api:getStopsCountGtfs() Start...');
let count=null;
try {
@ -15,12 +15,12 @@ export async function getStopsCountGtfs(){
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfs() Done.');
////console.log('api:getStopsCountGtfs() Done.');
return count;
};
export async function getStopsCountGtfsDe(){
//console.log('api:getStopsCountGtfsDe() Start...');
////console.log('api:getStopsCountGtfsDe() Start...');
let count=null;
try {
@ -32,12 +32,12 @@ export async function getStopsCountGtfsDe(){
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDe() Done.');
////console.log('api:getStopsCountGtfsDe() Done.');
return count;
};
export async function getStopsCountGtfsDeNotDhid(){
//console.log('api:getStopsCountGtfsDeNotDhid() Start...');
////console.log('api:getStopsCountGtfsDeNotDhid() Start...');
let count=null;
try {
@ -49,556 +49,12 @@ export async function getStopsCountGtfsDeNotDhid(){
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeHb(){
//console.log('api:getStopsCountGtfsDeHb() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-hb`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeHb() Done.');
return count;
};
export async function getStopsCountGtfsDeHbNotDhid(){
//console.log('api:getStopsCountGtfsDeHbNotDhid() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-hb-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeHbNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeHhNotDhid(){
//console.log('api:getStopsCountGtfsDeHhNotDhid() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-hh-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeHhNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeNiNotDhid(){
//console.log('api:getStopsCountGtfsDeNiNotDhid() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-ni-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeNiNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeHh(){
//console.log('api:getStopsCountGtfsDeHh() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-hh`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeHh() Done.');
return count;
};
export async function getStopsCountGtfsDeNi(){
//console.log('api:getStopsCountGtfsDeNi() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-ni`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeNi() Done.');
return count;
};
export async function getStopsCountGtfsDeSh(){
//console.log('api:getStopsCountGtfsDeSh() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-sh`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeSh() Done.');
return count;
};
export async function getStopsCountGtfsDeMv(){
//console.log('api:getStopsCountGtfsDeMv() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-mv`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeMv() Done.');
return count;
};
export async function getStopsCountGtfsDeBb(){
//console.log('api:getStopsCountGtfsDeBb() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-bb`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeBb() Done.');
return count;
};
export async function getStopsCountGtfsDeBe(){
//console.log('api:getStopsCountGtfsDeBe() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-be`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeBe() Done.');
return count;
};
export async function getStopsCountGtfsDeSt(){
//console.log('api:getStopsCountGtfsDeSt() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-st`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeSt() Done.');
return count;
};
export async function getStopsCountGtfsDeNw(){
//console.log('api:getStopsCountGtfsDeNw() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-nw`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeNw() Done.');
return count;
};
export async function getStopsCountGtfsDeHe(){
//console.log('api:getStopsCountGtfsDeHe() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-he`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeHe() Done.');
return count;
};
export async function getStopsCountGtfsDeSn(){
//console.log('api:getStopsCountGtfsDeSn() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-sn`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeSn() Done.');
return count;
};
export async function getStopsCountGtfsDeTh(){
//console.log('api:getStopsCountGtfsDeTh() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-th`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeTh() Done.');
return count;
};
export async function getStopsCountGtfsDeRp(){
//console.log('api:getStopsCountGtfsDeRp() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-rp`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeRp() Done.');
return count;
};
export async function getStopsCountGtfsDeSl(){
//console.log('api:getStopsCountGtfsDeSl() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-sl`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeSl() Done.');
return count;
};
export async function getStopsCountGtfsDeBy(){
//console.log('api:getStopsCountGtfsDeBy() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-by`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeBy() Done.');
return count;
};
export async function getStopsCountGtfsDeBw(){
//console.log('api:getStopsCountGtfsDeBw() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-bw`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeBw() Done.');
return count;
};
export async function getStopsCountGtfsDeShNotDhid(){
//console.log('api:getStopsCountGtfsDeShNotDhid() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-sh-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeShNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeMvNotDhid(){
//console.log('api:getStopsCountGtfsDeMvNotDhid() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-mv-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeMvNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeBbNotDhid(){
//console.log('api:getStopsCountGtfsDeBbNotDhid() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-bb-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeBbNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeBeNotDhid(){
//console.log('api:getStopsCountGtfsDeBeNotDhid() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-be-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeBeNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeStNotDhid(){
//console.log('api:getStopsCountGtfsDeStNotDhid() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-st-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeStNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeNwNotDhid(){
//console.log('api:getStopsCountGtfsDeNwNotDhid() Nwart...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-nw-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeNwNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeHeNotDhid(){
//console.log('api:getStopsCountGtfsDeHeNotDhid() Heart...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-he-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeHeNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeSnNotDhid(){
//console.log('api:getStopsCountGtfsDeSnNotDhid() Snart...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-sn-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeSnNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeThNotDhid(){
//console.log('api:getStopsCountGtfsDeThNotDhid() Thart...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-th-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeThNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeRpNotDhid(){
//console.log('api:getStopsCountGtfsDeRpNotDhid() Rpart...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-rp-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeRpNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeSlNotDhid(){
//console.log('api:getStopsCountGtfsDeSlNotDhid() Slart...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-sl-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeSlNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeByNotDhid(){
//console.log('api:getStopsCountGtfsDeByNotDhid() Byart...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-by-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeByNotDhid() Done.');
return count;
};
export async function getStopsCountGtfsDeBwNotDhid(){
//console.log('api:getStopsCountGtfsDeBwNotDhid() Bwart...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-bw-not-dhid`;
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsDeBwNotDhid() Done.');
////console.log('api:getStopsCountGtfsDeNotDhid() Done.');
return count;
};
export async function getGtfsStopsLastVacuum(){
console.log('api:getGtfsStopsLastVacuum() Start...');
//console.log('api:getGtfsStopsLastVacuum() Start...');
let date=null;
try {
@ -606,17 +62,17 @@ export async function getGtfsStopsLastVacuum(){
const address = `${config.API}gtfs-stops-last-vacuum`;
const res = await axios.get(address);
date=res.data[0].last_vacuum;
console.log('api:getGtfsStopsLastVacuum() date: ' + date);
//console.log('api:getGtfsStopsLastVacuum() date: ' + date);
} catch (err) {
console.error('err.message: ' + err.message);
date=-1;
}
console.log('api:getGtfsStopsLastVacuum() Done.');
//console.log('api:getGtfsStopsLastVacuum() Done.');
return date;
};
export async function getStopsCountGtfsLt0(){
//console.log('api:getStopsCountGtfsLt0() Start...');
////console.log('api:getStopsCountGtfsLt0() Start...');
let count=null;
try {
@ -624,12 +80,56 @@ export async function getStopsCountGtfsLt0(){
const address = `${config.API}stops-count-gtfs-lt-0`;
const res = await axios.get(address);
count=res.data[0].count;
console.log('api:getStopsCountGtfsLt0() count: ' + count);
//console.log('api:getStopsCountGtfsLt0() count: ' + count);
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
//console.log('api:getStopsCountGtfsLt0() Done.');
////console.log('api:getStopsCountGtfsLt0() Done.');
return count;
};
/**
* @param state string of state in DE as two lowercase characters
* @return count of stops inside this state as int
*/
export async function getGtfsStopsCountDeState(state){
////console.log('api:getGtfsStopsCountDeState() Start...');
//console.log('api:getGtfsStopsCountDeState() state: ' + state);
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-` + state;
//console.log('api:getGtfsStopsCountDeState() address: ' + address);
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
////console.log('api:getGtfsStopsCountDeState() Done.');
return count;
};
/**
* @param state string of state in DE as two lowercase characters
* @return count of stops inside this state as int missing Global Id
*/
export async function getGtfsStopsCountNotGiDeState(state){
////console.log('api:getGtfsStopsCountNotGiDeState() Start...');
let count=null;
try {
//TODO handle errors: https://www.valentinog.com/blog/await-react/
const address = `${config.API}stops-count-gtfs-de-` + state + '-not-dhid';
//console.log('api:getGtfsStopsCountNotGiDeState() address: ' + address);
const res = await axios.get(address);
count=res.data[0].count;
} catch (err) {
console.error('err.message: ' + err.message);
count=-1;
}
////console.log('api:getGtfsStopsCountNotGiDeState() Done.');
return count;
};