Rename methods to indicate a single responsibility

This commit is contained in:
2025-09-26 14:31:20 -07:00
parent c244a4b037
commit 9a2b2f65b9
7 changed files with 30 additions and 30 deletions

View File

@@ -28,18 +28,18 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader
return ids;
}
public async fetchAndUpdateAll() {
await this.fetchAndUpdateRouteDataForSystem();
await this.fetchAndUpdateStopAndPolylineDataForRoutesInSystem();
await this.fetchAndUpdateShuttleDataForSystem();
public async updateAll() {
await this.updateRouteDataForSystem();
await this.updateStopAndPolylineDataForRoutesInSystem();
await this.updateShuttleDataForSystem();
// Because ETA method doesn't support pruning yet,
// add a call to the clear method here
await this.repository.clearEtaData();
await this.fetchAndUpdateEtaDataForExistingStopsForSystem();
await this.updateEtaDataForExistingStopsForSystem();
}
public async fetchAndUpdateRouteDataForSystem() {
public async updateRouteDataForSystem() {
const systemId = this.passioSystemId;
const routeIdsToPrune = await this.constructExistingEntityIdSet(async () => {
return await this.repository.getRoutes();
@@ -90,7 +90,7 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader
}
}
public async fetchAndUpdateStopAndPolylineDataForRoutesInSystem() {
public async updateStopAndPolylineDataForRoutesInSystem() {
const passioSystemId = this.passioSystemId;
// Fetch from the API
@@ -131,7 +131,7 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader
}
}
public async fetchAndUpdateShuttleDataForSystem() {
public async updateShuttleDataForSystem() {
const systemId = this.passioSystemId;
const shuttleIdsToPrune = await this.constructExistingEntityIdSet(async () => {
return await this.repository.getShuttles();
@@ -191,15 +191,15 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader
}
}
public async fetchAndUpdateEtaDataForExistingStopsForSystem() {
public async updateEtaDataForExistingStopsForSystem() {
const stops = await this.repository.getStops();
await Promise.all(stops.map(async (stop) => {
let stopId = stop.id;
await this.fetchAndUpdateEtaDataForStopId(stopId);
await this.updateEtaDataForStopId(stopId);
}));
}
public async fetchAndUpdateEtaDataForStopId(stopId: string) {
public async updateEtaDataForStopId(stopId: string) {
const params = {
eta: "3",
stopIds: stopId,