Skip to content

Commit

Permalink
Merge pull request #23 from OpenHistoricalMap/876-tasking-manager-sta…
Browse files Browse the repository at this point in the history
…ts-failing-to-load

Addresses OpenHistoricalMap/issues#876
  • Loading branch information
erictheise authored Sep 1, 2024
2 parents 4ae06b3 + cea8272 commit 5c54ba5
Show file tree
Hide file tree
Showing 7 changed files with 816 additions and 35 deletions.
6 changes: 3 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"@openhistoricalmap/id": "^2.18.5",
"@placemarkio/geo-viewport": "^1.0.1",
"@sentry/react": "^7.60.1",
"@tmcw/togeojson": "^4.7.0",
"@tanstack/react-query": "^4.29.7",
"@tanstack/react-query-devtools": "^4.29.7",
"@tmcw/togeojson": "^4.7.0",
"@turf/area": "^6.5.0",
"@turf/bbox": "^6.5.0",
"@turf/bbox-polygon": "^6.5.0",
Expand Down Expand Up @@ -113,6 +113,7 @@
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@sentry/cli": "^2.20.5",
"@tanstack/eslint-plugin-query": "^4.29.8",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.1.5",
Expand All @@ -124,8 +125,7 @@
"prettier": "^2.8.8",
"react-select-event": "^5.5.1",
"react-test-renderer": "^17.0.2",
"source-map-explorer": "^2.5.3",
"@sentry/cli": "^2.20.5"
"source-map-explorer": "^2.5.3"
},
"jest": {
"coverageReporters": [
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/api/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { HOMEPAGE_STATS_API_URL } from '../config';

export const useSystemStatisticsQuery = () => {
const fetchSystemStats = ({ signal }) => {
return api().get(`system/statistics/`, {
return api().get(HOMEPAGE_STATS_API_URL, {
signal,
});
};
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/components/homepage/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ export default defineMessages({
id: 'home.stats.mappers',
defaultMessage: 'Mappers Online',
},
ohmTasksStats: {
id: 'home.stats.tasks',
defaultMessage: 'Tasks Mapped',
},
ohmProjectsStats: {
id: 'home.stats.projects',
defaultMessage: 'Historical Projects',
},
statsLoadingError: {
id: 'home.stats.loading.error',
defaultMessage: 'An error occured while loading the stats',
Expand Down
16 changes: 6 additions & 10 deletions frontend/src/components/homepage/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,16 @@ export const StatsSection = () => {
<>
<div className="pt5 pb2 ph6-l ph4 flex justify-around flex-wrap flex-nowrap-ns stats-container">
<StatsColumn
label={messages.buildingsStats}
value={hasStatsLoaded ? osmStatsData?.data.building_count_add : undefined}
/>
<StatsColumn
label={messages.roadsStats}
value={hasStatsLoaded ? osmStatsData?.data.road_km_add : undefined}
label={messages.communityStats}
value={hasStatsLoaded ? tmStatsData?.data.totalMappers : undefined}
/>
<StatsColumn
label={messages.editsStats}
value={hasStatsLoaded ? osmStatsData?.data.edits : undefined}
label={messages.ohmTasksStats}
value={hasStatsLoaded ? tmStatsData?.data.tasksMapped : undefined}
/>
<StatsColumn
label={messages.communityStats}
value={hasStatsLoaded ? tmStatsData?.data.totalMappers : undefined}
label={messages.ohmProjectsStats}
value={hasStatsLoaded ? tmStatsData?.data.totalProjects : undefined}
/>
<StatsColumn
label={messages.mappersStats}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { FeatureStats } from '../components/teamsAndOrgs/featureStats';
export const Stats = () => {
useSetTitleTag('Stats');
const [query, setQuery] = useTasksStatsQueryParams();
const [apiState, fetchTasksStatistics] = useTasksStatsQueryAPI({ taskStats: [] }, query);
const [apiState, fetchTasks] = useTasksStatsQueryAPI({ taskStats: [] }, query);

return (
<div className="w-100 cf pv4">
Expand Down
Loading

0 comments on commit 5c54ba5

Please sign in to comment.