Skip to content

Commit

Permalink
Merge pull request #77 from SmartColumbusOS/remove-streaming-shuttles
Browse files Browse the repository at this point in the history
Removed CEAV from available routes
  • Loading branch information
LtChae authored Oct 8, 2019
2 parents 6332fea + f08d07a commit 7fd30c6
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 174 deletions.
41 changes: 11 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"moduleNameMapper": {
"\\.(css|scss|png)$": "identity-obj-proxy",
"blue-bus\\.svg": "<rootDir>/test-helpers/blue-svg.js",
"smart_circuit\\.svg": "<rootDir>/test-helpers/smart-circuit-svg.js",
"\\.(svg)$": "<rootDir>/test-helpers/mock-svg-string.js"
}
}
Expand Down
6 changes: 0 additions & 6 deletions src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@ export const ROUTE_FETCH = 'ROUTE_FETCH'

export const ROUTE_UPDATE = 'ROUTE_UPDATE'

export const CEAV_UPDATE = 'CEAV_UPDATE'

export const positionUpdate = (message) => {
return { type: POSITION_UPDATE, update: message }
}

export const ceavUpdate = (message) => {
return { type: CEAV_UPDATE, update: message }
}

export const applyStreamFilter = (filter) => {
return { type: ROUTE_FILTER, filter: filter }
}
Expand Down
1 change: 0 additions & 1 deletion src/assets/smart_circuit.svg

This file was deleted.

6 changes: 0 additions & 6 deletions src/components/cota-position-map/icon-factory.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import leaflet from 'leaflet'
import busBlueSvg from '../../assets/blue-bus.svg'
import ceavSvg from '../../assets/smart_circuit.svg'
import locationPin from '../../assets/ic_location-dot.svg'
import { CEAV } from '../../variables'

const createBusIcon = (zoomLevel, provider) => {
let iconUrl = busBlueSvg
let iconSize = [3.2 * zoomLevel, 2.75 * zoomLevel]
if (CEAV === provider) {
iconUrl = ceavSvg
iconSize = [2 * zoomLevel, 2 * zoomLevel]
}

return leaflet.icon({
iconUrl: iconUrl,
Expand Down
10 changes: 0 additions & 10 deletions src/components/cota-position-map/icon-factory.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import leaflet from 'leaflet'
import busBlueSvg from '../../assets/blue-bus.svg'
import smartCircuitIcon from '../../assets/smart_circuit.svg'
import iconFactory from './icon-factory'
import locationPin from '../../assets/ic_location-dot.svg'

Expand All @@ -26,13 +25,4 @@ describe('Icon Factory', () => {
iconSize: [32, 27.5]
})
})

it('creates green bus icons for CEAV shuttles', () => {
iconFactory.createBusIcon(10, 'CEAV')

expect(leaflet.icon).toHaveBeenCalledWith({
iconUrl: smartCircuitIcon,
iconSize: [20, 20]
})
})
})
2 changes: 1 addition & 1 deletion src/components/url-route-filter/url-route-filter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('UrlRouteFilter', () => {
describe('when user types in invalid route id in url', () => {
beforeEach(() => {
subject = createSubject({ selectedRouteId: '2', urlRouteId: '2' })
subject.setProps({ match: { params: { routeId: 'CEAVY' } } })
subject.setProps({ match: { params: { routeId: 'HEENDERSON' } } })
})

it('updates state to url param', () => {
Expand Down
20 changes: 2 additions & 18 deletions src/reducers/reducers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { combineReducers } from 'redux'
import { POSITION_UPDATE, ROUTE_FILTER, CEAV_UPDATE, ROUTE_UPDATE } from '../actions'
import { CEAV, COTA } from '../variables'
import { POSITION_UPDATE, ROUTE_FILTER, ROUTE_UPDATE } from '../actions'
import { COTA } from '../variables'
import _ from 'lodash'

const filter = (filter = [], action) => {
Expand All @@ -15,9 +15,6 @@ const filter = (filter = [], action) => {
const provider = (provider = { name: COTA }, action) => {
switch (action.type) {
case ROUTE_FILTER:
if (CEAV === action.filter[0]) {
return Object.assign({}, provider, { name: CEAV })
}
return Object.assign({}, provider, { name: COTA })
default:
return provider
Expand All @@ -39,18 +36,6 @@ const data = (data = {}, action) => {
}

return Object.assign({}, data, { [value.vehicleId]: value })
case CEAV_UPDATE:
let ceavVehicle = action.update
let busToPutOnMap = {
vehicleId: ceavVehicle.vehicle_id,
latitude: ceavVehicle.latitude,
longitude: ceavVehicle.longitude,
timestamp: ceavVehicle.update_time,
provider: ceavVehicle.provider,
bearing: 0
}

return Object.assign({}, data, { [busToPutOnMap.vehicleId]: busToPutOnMap })
case ROUTE_FILTER:
return {}
default:
Expand All @@ -68,7 +53,6 @@ const availableRoutes = (availableRoutes = [], action) => {
const lineName = `${route.linenum} - ${route.linename}`
return { value: lineNumber, label: lineName, provider: 'COTA' }
})
routesToUse.push({ value: CEAV, label: 'SMRT - Smart Circuit', provider: CEAV })
return routesToUse
default:
return availableRoutes
Expand Down
16 changes: 0 additions & 16 deletions src/reducers/reducers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,6 @@ describe('cotaApp reducers', () => {
expect(newState.availableRoutes[1]).toEqual(state[1])
})

it('will append CEAV Smart Circuit on a ROUTE_UPDATE action', () => {
let message = [
{
'linenum': 1,
'linename': 'Crazy Town'
},
{
'linenum': 101,
'linename': 'Smallville'
}
]

let newState = reducer(undefined, { type: ROUTE_UPDATE, update: message })
expect(newState.availableRoutes[2]).toEqual({ value: 'CEAV', label: 'SMRT - Smart Circuit', provider: 'CEAV' })
})

it('will not transform the availableRoutes on an unknown event', () => {
let newState = reducer({ availableRoutes: [{ value: '001', label: '1 - Crazy Town' }] }, { type: 'UNKNOWN_ACTION', stuff: [] })
expect(newState.availableRoutes).toEqual([{ value: '001', label: '1 - Crazy Town' }])
Expand Down
2 changes: 0 additions & 2 deletions src/sagas/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import webSocketSaga from './websocket'
import shuttleWebSocketSaga from './shuttleWebSocketSaga'
import routeSaga from './route'
import { fork, all } from 'redux-saga/effects'

export default function* allSagas() {
yield all([
fork(webSocketSaga),
fork(shuttleWebSocketSaga),
fork(routeSaga)
])
}
79 changes: 0 additions & 79 deletions src/sagas/shuttleWebSocketSaga.js

This file was deleted.

Loading

0 comments on commit 7fd30c6

Please sign in to comment.