Skip to content

Commit

Permalink
chore: remove console.log statements (#206)
Browse files Browse the repository at this point in the history
solve #200
  • Loading branch information
Abhid1239 authored Nov 13, 2023
1 parent c29b7f2 commit bb178a3
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 35 deletions.
2 changes: 0 additions & 2 deletions src/api/gapsService.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import moment, { Moment } from 'moment-timezone'
import { GapsList } from '../model/gaps'
import { log } from '../log'
import axios from 'axios'
import { BASE_PATH } from './apiConfig'

Expand Down Expand Up @@ -30,7 +29,6 @@ export const getGapsAsync = async (
operatorId: string,
lineRef: number,
): Promise<GapsList> => {
log('Searching for gaps', { operatorId, lineRef })
const fromDay = moment(fromTimestamp).startOf('day')
const toDay = moment(toTimestamp).startOf('day')
// const startOfDay = moment(fromTimestamp).startOf('day')
Expand Down
2 changes: 0 additions & 2 deletions src/api/geoService.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { computeDestinationPoint, findNearest } from 'geolib'
import { Coordinates, CoordinatesBoundary } from 'src/model/location'
import { log } from 'src/log'

export function geoLocationBoundary(location: Coordinates, byMeters: number): CoordinatesBoundary {
const moveUp = computeDestinationPoint(location, byMeters, 0)
Expand All @@ -11,7 +10,6 @@ export function geoLocationBoundary(location: Coordinates, byMeters: number): Co
lowerBound: { longitude: moveLeft.longitude, latitude: moveDown.latitude },
upperBound: { longitude: moveRight.longitude, latitude: moveUp.latitude },
}
log('getting boundary', { location, byMeters, boundary })
return boundary
}

Expand Down
10 changes: 0 additions & 10 deletions src/api/gtfsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import moment, { Moment } from 'moment'
import { BusRoute, fromGtfsRoute } from 'src/model/busRoute'
import { BusStop, fromGtfsStop } from 'src/model/busStop'
import { API_CONFIG, MAX_HITS_COUNT } from 'src/api/apiConfig'
import { log } from 'src/log'

const GTFS_API = new GtfsApi(API_CONFIG)
//const USER_CASES_API = new UserCasesApi(API_CONFIG)
Expand All @@ -16,7 +15,6 @@ export async function getRoutesAsync(
operatorId: string,
lineNumber: string,
): Promise<BusRoute[]> {
log('looking up routes', { operatorId, lineNumber })
const gtfsRoutes = await GTFS_API.gtfsRoutesListGet({
routeShortName: lineNumber,
operatorRefs: operatorId,
Expand All @@ -38,15 +36,13 @@ export async function getRoutesAsync(
return agg
}, {} as Record<string, BusRoute>),
)
log('fetched routes', routes.length)
return routes
}

export async function getStopsForRouteAsync(
routeIds: number[],
timestamp: Moment,
): Promise<BusStop[]> {
log('looking up stops', routeIds)
const stops: BusStop[] = []

for (const routeId of routeIds) {
Expand All @@ -71,7 +67,6 @@ export async function getStopsForRouteAsync(
}),
)
}
log('fetched stops', stops.length)
return stops.sort((a, b) =>
a.stopSequence === b.stopSequence
? a.name.localeCompare(b.name)
Expand All @@ -81,11 +76,6 @@ export async function getStopsForRouteAsync(

export async function getGtfsStopHitTimesAsync(stop: BusStop, timestamp: Moment) {
const targetStartTime = moment(timestamp).subtract(stop.minutesFromRouteStartTime, 'minutes')
log('looking for rides starting around time', {
stopId: stop.stopId,
min: stop.minutesFromRouteStartTime,
targetStartTime: targetStartTime.toDate(),
})

const rides = await GTFS_API.gtfsRidesListGet({
gtfsRouteId: stop.routeId,
Expand Down
7 changes: 0 additions & 7 deletions src/api/siriService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { BusStop } from 'src/model/busStop'
import moment, { Moment } from 'moment'
import { geoLocationBoundary, nearestLocation } from 'src/api/geoService'
import { Coordinates } from 'src/model/location'
import { log } from 'src/log'
import { BusRoute } from 'src/model/busRoute'
import { SiriRideWithRelatedPydanticModel } from 'open-bus-stride-client/openapi/models/SiriRideWithRelatedPydanticModel'

Expand Down Expand Up @@ -43,12 +42,6 @@ export async function getSiriRideWithRelated(
}

export async function getSiriStopHitTimesAsync(route: BusRoute, stop: BusStop, timestamp: Moment) {
log('looking for rides arriving at stop around time', {
route,
stopId: stop.stopId,
timestamp: timestamp.seconds(0).milliseconds(0).toDate(),
})

const rides = await getRidesAsync(route, stop, timestamp)
if (rides.length === 0) {
return []
Expand Down
10 changes: 0 additions & 10 deletions src/complaint/complaint.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,12 @@ try {
for (let attempt = 0; attempt < 3; attempt++) {
try {
await page.goto(url)
console.log('page loaded')
await page.click('text=כניסה לטופס')
await page.getByLabel('שם פרטי').fill(complaint.firstName)
await page.getByLabel('שם משפחה').fill(complaint.lastName)
await page.getByLabel('מספר זהות').fill(complaint.id)
await page.getByLabel('טלפון נייד', { exact: true }).fill(complaint.phone)
await page.getByRole('textbox', { name: 'דואר אלקטרוני' }).fill(complaint.email)

console.log('filled first page')

await page.getByRole('button', { name: 'לשלב הבא' }).click()
// await page.getByLabel('נושא הפנייה').getByLabel('בחירה מהרשימה').first().click()
// await new Promise((r) => setTimeout(r, 100))
Expand All @@ -59,9 +55,6 @@ try {
await new Promise((r) => setTimeout(r, 100))
await page.getByText(complaintTypes[0]).click()
await new Promise((r) => setTimeout(r, 100))

console.log('filled second page')

await page.getByRole('button', { name: 'לשלב הבא' }).click()
await page.getByLabel('חברת האוטובוסים (מפעיל)').fill(complaint.operator)
await page.getByRole('textbox', { name: 'מספר רישוי' }).fill(complaint.licensePlate)
Expand All @@ -72,12 +65,9 @@ try {
await page
.getByRole('textbox', { name: 'תוכן הפנייה' })
.fill('האוטובוס עצר בתחנה ולא נסע עד שעה מאוחרת')

await page.getByRole('textbox', { name: 'מספר קו' }).fill(complaint.lineNumber)
await page.getByLabel('מוצא/ יעד (כיוון )').fill(complaint.routeName)

console.log('filled third page')

for (let i = 0; i < 10 && (await page.getByText('הנחיות לצירוף מסמכים').isHidden()); i++) {
// retry until it works
await page.getByRole('button', { name: 'לשלב הבא' }).click()
Expand Down
2 changes: 0 additions & 2 deletions src/pages/TimelinePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import StopSelector from 'src/pages/components/StopSelector'
import { Spin } from 'antd'
import { getSiriStopHitTimesAsync } from 'src/api/siriService'
import { TimelineBoard } from 'src/pages/components/timeline/TimelineBoard'
import { log } from 'src/log'
import { PageContainer } from './components/PageContainer'
import { SearchContext, TimelinePageState } from '../model/pageState'
import { NotFound } from './components/NotFound'
Expand Down Expand Up @@ -125,7 +124,6 @@ const TimelinePage = () => {
}
const newStopKey = stops.find((stop) => stop.name === stopName)?.key
if (newStopKey) {
log(`setting new stopKey=${newStopKey} using the prev stopName=${stopName}`)
setState((current) => ({ ...current, stopKey: newStopKey }))
}
}, [timestamp, stops])
Expand Down
1 change: 0 additions & 1 deletion src/pages/components/timeline/Timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export const Timeline = ({
(timestamp as SiriVehicleLocationWithRelatedPydanticModel & Coordinates)
.recordedAtTime! ??
(timestamp as Date)
console.log(t, timestamp)

return (
<LabeledPoint
Expand Down
1 change: 0 additions & 1 deletion src/pages/dashboard/HbarChart/HbarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export function HbarChart({
percent: percents[idx],
...entry,
}))
console.log(rows[0])

const wrapWithTooltip = (element: React.ReactElement, entry: Entry) => {
return (
Expand Down

0 comments on commit bb178a3

Please sign in to comment.