Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions community-dashboard/app/views/StatsBoard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import {
ProjectTypeSwipeStatsType,
ProjectTypeAreaStatsType,
ContributorSwipeStatType,
ProjectTypeEnum,
} from '#generated/types';
import { mergeItems } from '#utils/common';
import {
Expand All @@ -67,17 +68,28 @@ const CHART_BREAKPOINT = 700;
export type ActualContributorTimeStatType = ContributorTimeStatType & { totalSwipeTime: number };
const UNKNOWN = '-1';
const BUILD_AREA = 'BUILD_AREA';
const MEDIA = 'MEDIA';
const DIGITIZATION = 'DIGITIZATION';
const FOOTPRINT = 'FOOTPRINT';
const CHANGE_DETECTION = 'CHANGE_DETECTION';
const VALIDATE_IMAGE = 'VALIDATE_IMAGE';
const COMPLETENESS = 'COMPLETENESS';
const STREET = 'STREET';

// FIXME: the name property is not used properly
const projectTypes: Record<string, { color: string, name: string }> = {
const projectTypes: Record<ProjectTypeEnum | '-1', { color: string, name: string }> = {
[UNKNOWN]: {
color: '#cacaca',
name: 'Unknown',
},
[MEDIA]: {
color: '#cacaca',
name: 'Media',
},
[DIGITIZATION]: {
color: '#cacaca',
name: 'Digitization',
},
[BUILD_AREA]: {
color: '#f8a769',
name: 'Find',
Expand All @@ -94,6 +106,10 @@ const projectTypes: Record<string, { color: string, name: string }> = {
color: '#fb8072',
name: 'Completeness',
},
[VALIDATE_IMAGE]: {
color: '#a1b963',
name: 'Validate Image',
},
[STREET]: {
color: '#808080',
name: 'Street',
Expand Down Expand Up @@ -376,14 +392,16 @@ function StatsBoard(props: Props) {
const sortedProjectSwipeType = useMemo(
() => (
swipeByProjectType
?.map((item) => ({
...item,
projectType: (
isDefined(item.projectType)
&& isDefined(projectTypes[item.projectType])
) ? item.projectType
: UNKNOWN,
}))
?.map((item) => {
const projectType: ProjectTypeEnum | '-1' = (
isDefined(item.projectType) && isDefined(projectTypes[item.projectType])
) ? item.projectType : UNKNOWN;

return ({
...item,
projectType,
});
})
.sort((a, b) => compareNumber(a.totalSwipes, b.totalSwipes, -1)) ?? []
),
[swipeByProjectType],
Expand Down
3 changes: 1 addition & 2 deletions community-dashboard/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ version: '3.3'

services:
react:
build: .
command: sh -c 'yarn install --frozen-lockfile && yarn start'
build:
context: ./
Expand All @@ -15,4 +14,4 @@ services:
volumes:
- .:/code
ports:
- '3080:3080'
- '3081:3081'
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
WHEN P.project_type = {Project.Type.CHANGE_DETECTION.value} THEN 11.2
-- FOOTPRINT: Not calculated right now
WHEN P.project_type = {Project.Type.FOOTPRINT.value} THEN 6.1
WHEN P.project_type = {Project.Type.VALIDATE_IMAGE.value} THEN 6.1
WHEN P.project_type = {Project.Type.STREET.value} THEN 65
ELSE 1
END
Expand Down Expand Up @@ -111,6 +112,7 @@
WHEN P.project_type = {Project.Type.CHANGE_DETECTION.value} THEN 11.2
-- FOOTPRINT: Not calculated right now
WHEN P.project_type = {Project.Type.FOOTPRINT.value} THEN 6.1
WHEN P.project_type = {Project.Type.VALIDATE_IMAGE.value} THEN 6.1
WHEN P.project_type = {Project.Type.STREET.value} THEN 65
ELSE 1
END
Expand All @@ -136,8 +138,10 @@
G.group_id,
(
CASE
-- Hide area for Footprint
-- Hide area for Footprint and Validate Image
-- FIXME: What should we do for Project.Type.STREET.value
WHEN P.project_type = {Project.Type.FOOTPRINT.value} THEN 0
WHEN P.project_type = {Project.Type.VALIDATE_IMAGE.value} THEN 0
ELSE G.total_area
END
) as total_task_group_area,
Expand Down
1 change: 1 addition & 0 deletions django/apps/existing_database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class Type(models.IntegerChoices):
MEDIA = 5, "Media"
DIGITIZATION = 6, "Digitization"
STREET = 7, "Street"
VALIDATE_IMAGE = 10, "Validate Image"

project_id = models.CharField(primary_key=True, max_length=999)
created = models.DateTimeField(blank=True, null=True)
Expand Down
1 change: 1 addition & 0 deletions django/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ enum ProjectTypeEnum {
MEDIA
DIGITIZATION
STREET
VALIDATE_IMAGE
}

type ProjectTypeSwipeStatsType {
Expand Down