Skip to content

Commit 819af11

Browse files
AdityaKhatrifrozenhelium
authored andcommitted
feat(validate_image): add validate image updates in community dashboard
1 parent 26efb0a commit 819af11

File tree

4 files changed

+30
-11
lines changed

4 files changed

+30
-11
lines changed

community-dashboard/app/views/StatsBoard/index.tsx

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import {
4949
ProjectTypeSwipeStatsType,
5050
ProjectTypeAreaStatsType,
5151
ContributorSwipeStatType,
52+
ProjectTypeEnum,
5253
} from '#generated/types';
5354
import { mergeItems } from '#utils/common';
5455
import {
@@ -67,17 +68,28 @@ const CHART_BREAKPOINT = 700;
6768
export type ActualContributorTimeStatType = ContributorTimeStatType & { totalSwipeTime: number };
6869
const UNKNOWN = '-1';
6970
const BUILD_AREA = 'BUILD_AREA';
71+
const MEDIA = 'MEDIA';
72+
const DIGITIZATION = 'DIGITIZATION';
7073
const FOOTPRINT = 'FOOTPRINT';
7174
const CHANGE_DETECTION = 'CHANGE_DETECTION';
75+
const VALIDATE_IMAGE = 'VALIDATE_IMAGE';
7276
const COMPLETENESS = 'COMPLETENESS';
7377
const STREET = 'STREET';
7478

7579
// FIXME: the name property is not used properly
76-
const projectTypes: Record<string, { color: string, name: string }> = {
80+
const projectTypes: Record<ProjectTypeEnum | '-1', { color: string, name: string }> = {
7781
[UNKNOWN]: {
7882
color: '#cacaca',
7983
name: 'Unknown',
8084
},
85+
[MEDIA]: {
86+
color: '#cacaca',
87+
name: 'Media',
88+
},
89+
[DIGITIZATION]: {
90+
color: '#cacaca',
91+
name: 'Digitization',
92+
},
8193
[BUILD_AREA]: {
8294
color: '#f8a769',
8395
name: 'Find',
@@ -94,6 +106,10 @@ const projectTypes: Record<string, { color: string, name: string }> = {
94106
color: '#fb8072',
95107
name: 'Completeness',
96108
},
109+
[VALIDATE_IMAGE]: {
110+
color: '#a1b963',
111+
name: 'Validate Image',
112+
},
97113
[STREET]: {
98114
color: '#808080',
99115
name: 'Street',
@@ -376,14 +392,16 @@ function StatsBoard(props: Props) {
376392
const sortedProjectSwipeType = useMemo(
377393
() => (
378394
swipeByProjectType
379-
?.map((item) => ({
380-
...item,
381-
projectType: (
382-
isDefined(item.projectType)
383-
&& isDefined(projectTypes[item.projectType])
384-
) ? item.projectType
385-
: UNKNOWN,
386-
}))
395+
?.map((item) => {
396+
const projectType: ProjectTypeEnum | '-1' = (
397+
isDefined(item.projectType) && isDefined(projectTypes[item.projectType])
398+
) ? item.projectType : UNKNOWN;
399+
400+
return ({
401+
...item,
402+
projectType,
403+
});
404+
})
387405
.sort((a, b) => compareNumber(a.totalSwipes, b.totalSwipes, -1)) ?? []
388406
),
389407
[swipeByProjectType],

community-dashboard/docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ version: '3.3'
22

33
services:
44
react:
5-
build: .
65
command: sh -c 'yarn install --frozen-lockfile && yarn start'
76
build:
87
context: ./
@@ -15,4 +14,4 @@ services:
1514
volumes:
1615
- .:/code
1716
ports:
18-
- '3080:3080'
17+
- '3081:3081'

django/apps/existing_database/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class Type(models.IntegerChoices):
6969
MEDIA = 5, "Media"
7070
DIGITIZATION = 6, "Digitization"
7171
STREET = 7, "Street"
72+
VALIDATE_IMAGE = 10, "Validate Image"
7273

7374
project_id = models.CharField(primary_key=True, max_length=999)
7475
created = models.DateTimeField(blank=True, null=True)

django/schema.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ enum ProjectTypeEnum {
100100
MEDIA
101101
DIGITIZATION
102102
STREET
103+
VALIDATE_IMAGE
103104
}
104105

105106
type ProjectTypeSwipeStatsType {

0 commit comments

Comments
 (0)