Skip to content

Commit 6eb0289

Browse files
author
Sara Siegal
committed
Remove fallback-to-prior-year functionality
1 parent 8c99531 commit 6eb0289

1 file changed

Lines changed: 4 additions & 31 deletions

File tree

src/features/Map/index.jsx

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ class MapContainer extends React.Component {
7171
createRequestsTable = async () => {
7272
this.setState({ isTableLoading: true });
7373
const { setDbStartTime } = this.context;
74-
const { startDate, endDate, dispatchUpdateStartDate, dispatchUpdateEndDate } = this.props;
74+
const { startDate } = this.props;
7575
let year = moment(startDate).year(); // extract the year
7676
const tableNameByYear = `requests_${year}`;
7777
let datasetFileName = `requests${year}.parquet`;
7878

7979
// Create the year data table if not exist already
80-
let createSQL = `CREATE TABLE IF NOT EXISTS ${tableNameByYear} AS SELECT * FROM '${datasetFileName}'`; // query from parquet
80+
const createSQL = `CREATE TABLE IF NOT EXISTS ${tableNameByYear} AS SELECT * FROM '${datasetFileName}'`; // query from parquet
8181

8282
const startTime = performance.now(); // start the time tracker
8383
setDbStartTime(startTime);
@@ -91,38 +91,11 @@ class MapContainer extends React.Component {
9191
)} ms.`
9292
);
9393
} catch (error) {
94-
console.warn(`Failed to load dataset for year ${year}, falling back to prior year:`, error);
95-
96-
// Fall back to prior year
97-
const priorYear = year - 1;
98-
const priorTableName = `requests_${priorYear}`;
99-
const priorDatasetFileName = `requests${priorYear}.parquet`;
100-
const priorCreateSQL = `CREATE TABLE IF NOT EXISTS ${priorTableName} AS SELECT * FROM '${priorDatasetFileName}'`;
101-
102-
try {
103-
await this.useConnQuery(priorCreateSQL);
104-
console.log(`Successfully fell back to ${priorYear} dataset`);
105-
106-
// Update date filters to use prior year's date range
107-
const newEndDate = moment(`${priorYear}-12-31`).format(INTERNAL_DATE_SPEC);
108-
const newStartDate = moment(startDate).year(priorYear).format(INTERNAL_DATE_SPEC);
109-
110-
// Only update if the dates actually need to change
111-
if (moment(endDate).year() > priorYear) {
112-
dispatchUpdateEndDate(newEndDate);
113-
}
114-
if (moment(startDate).year() > priorYear) {
115-
dispatchUpdateStartDate(newStartDate);
116-
}
117-
} catch (fallbackError) {
118-
console.error("Error loading fallback dataset:", fallbackError);
119-
}
120-
} finally {
121-
this.setState({ isTableLoading: false });
94+
console.error(`Failed to load dataset for year ${year}:`, error);
12295
}
12396
};
12497

125-
async componentDidMount(props) {
98+
async componentDidMount() {
12699
this.isSubscribed = true;
127100
this.processSearchParams();
128101
if (DATA_SOURCE !== "SOCRATA") await this.createRequestsTable();

0 commit comments

Comments
 (0)