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
3 changes: 2 additions & 1 deletion app/components/ItemSelectInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ query UserGroupOptions($search: String, $offset: Int!, $limit: Int!) {
) {
results {
id
firebaseId
isArchived
clientId
name
Expand Down Expand Up @@ -223,7 +224,7 @@ function ItemSelectInput<Name extends string>(props: ItemSelectInputProps<Name>)
type: 'user' as const,
})) ?? []),
...(userGroupsData?.map((userGroup) => ({
id: userGroup.id,
id: userGroup.firebaseId,
name: userGroup.name ?? 'Unknown',
type: 'user-group' as const,
isArchived: userGroup.isArchived ?? false,
Expand Down
23 changes: 13 additions & 10 deletions app/views/UserDashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ import styles from './styles.module.css';

const USER_STATS = gql`
query UserStats($pk: ID!, $limit: Int!, $offset: Int!) {
contributorUserByFirebaseId(firebaseId: $pk) {
contributorUser(userId: {firebaseId: $pk}) {
id
firebaseId
username
}
communityUserStats(firebaseId: $pk) {
communityUserStats(userId: {firebaseId: $pk}) {
id
stats {
totalSwipes
Expand All @@ -59,8 +59,11 @@ const USER_STATS = gql`
) {
results {
id
firebaseId
name
membersCount
userMemberships {
totalCount
}
}
totalCount
}
Expand All @@ -69,7 +72,7 @@ const USER_STATS = gql`

const FILTERED_USER_STATS = gql`
query FilteredUserStats($pk: ID!, $fromDate: Date!, $toDate: Date!) {
communityUserStats(firebaseId: $pk) {
communityUserStats(userId: {firebaseId: $pk}) {
id
filteredStats(dateRange: {fromDate: $fromDate, toDate: $toDate}) {
id
Expand Down Expand Up @@ -196,10 +199,10 @@ function UserDashboard(props: Props) {

// NOTE: OSM user does not have username stored
const userName = useMemo(() => {
if (isDefined(userStats) && isDefined(userStats.contributorUserByFirebaseId)) {
return isFalsyString(userStats.contributorUserByFirebaseId.username)
? userStats.contributorUserByFirebaseId.firebaseId
: userStats.contributorUserByFirebaseId.username;
if (isDefined(userStats) && isDefined(userStats.contributorUser)) {
return isFalsyString(userStats.contributorUser.username)
? userStats.contributorUser.firebaseId
: userStats.contributorUser.username;
}

return null;
Expand Down Expand Up @@ -256,14 +259,14 @@ function UserDashboard(props: Props) {
className={styles.link}
to={generatePath(
routes.userGroupDashboard.path,
{ userGroupId: group.id },
{ userGroupId: group.firebaseId },
)}
>
{group.name}
</Link>
)}
description={
`${group.membersCount} ${group.membersCount > 1
`${group.userMemberships?.totalCount} ${group.userMemberships?.totalCount > 1
? 'members'
: 'member'
}`
Expand Down
12 changes: 5 additions & 7 deletions app/views/UserGroupDashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ const EXPORT_LIMIT = 500;

const USER_GROUP_STATS = gql`
query UserGroupStats($pk: ID!, $limit: Int!, $offset: Int!) {
contributorUserGroup(id: $pk) {
contributorUserGroup(userGroupId: {firebaseId: $pk}) {
id
name
description
membersCount
userMemberships(pagination: {limit: $limit, offset: $offset}) {
totalCount
results {
Expand All @@ -61,7 +60,7 @@ query UserGroupStats($pk: ID!, $limit: Int!, $offset: Int!) {
}
}
}
communityUserGroupStats(userGroupId: $pk) {
communityUserGroupStats(userGroupId: {firebaseId: $pk}) {
id
stats {
totalContributors
Expand All @@ -79,7 +78,7 @@ query UserGroupStats($pk: ID!, $limit: Int!, $offset: Int!) {

const FILTERED_USER_GROUP_STATS = gql`
query FilteredUserGroupStats($pk: ID!, $fromDate: Date! $toDate: Date!) {
communityUserGroupStats(userGroupId: $pk) {
communityUserGroupStats(userGroupId: {firebaseId: $pk}) {
id
filteredStats(dateRange: {fromDate: $fromDate, toDate: $toDate}) {
areaSwipedByProjectType {
Expand Down Expand Up @@ -119,11 +118,10 @@ const USER_MEMBERSHIPS_EXPORT = gql`
$limit: Int!,
$offset: Int!,
) {
contributorUserGroup(id: $pk) {
contributorUserGroup(userGroupId: {firebaseId: $pk}) {
id
name
description
membersCount
userMemberships(pagination: {limit: $limit, offset: $offset}) {
totalCount
results {
Expand Down Expand Up @@ -303,7 +301,7 @@ function UserGroupDashboard(props: Props) {
);

const memberList = userGroupStats?.contributorUserGroup?.userMemberships?.results;
const totalMembers = userGroupStats?.contributorUserGroup?.membersCount ?? 0;
const totalMembers = userGroupStats?.contributorUserGroup?.userMemberships?.totalCount ?? 0;

const memberRendererParams = useCallback((_: string, item: UserGroupMember) => (
{
Expand Down
2 changes: 1 addition & 1 deletion backend
Submodule backend updated 57 files
+88 −1 CHANGELOG.md
+8 −6 apps/community_dashboard/graphql/queries.py
+9 −5 apps/community_dashboard/graphql/types.py
+22 −0 apps/community_dashboard/tasks.py
+5 −5 apps/community_dashboard/tests/query_test.py
+4 −0 apps/contributor/firebase/pull.py
+14 −7 apps/contributor/graphql/queries.py
+59 −11 apps/existing_database/management/commands/loaddata_from_existing_database.py
+4 −0 apps/existing_database/models.py
+16 −1 apps/mapping/models.py
+20 −3 apps/project/exports/exports.py
+5 −3 apps/project/exports/mapping_results.py
+1 −1 apps/project/exports/project_stats_by_date.py
+2 −1 apps/project/exports/project_tasks.py
+6 −3 apps/project/exports/tasking_manager_geometries.py
+2 −0 apps/project/exports/utils/common.py
+3 −2 apps/project/graphql/queries.py
+2 −8 apps/project/graphql/types/types.py
+17 −0 apps/project/migrations/0010_alter_projecttask_unique_together.py
+9 −7 apps/project/models.py
+2 −2 apps/project/serializers.py
+6 −17 apps/project/slack_messages.py
+3 −3 apps/project/tasks.py
+313 −1 apps/project/tests/e2e_create_project_tile_map_service_test.py
+305 −2 apps/project/tests/e2e_create_street_project_test.py
+276 −2 apps/project/tests/e2e_create_validate_image_project_test.py
+302 −2 apps/project/tests/e2e_create_validate_project_test.py
+1 −0 apps/project/tests/export_test.py
+20 −10 apps/project/tests/mutation_test.py
+74 −27 apps/tutorial/tests/mutation_test.py
+31 −1 apps/user/admin.py
+1 −1 assets
+3 −1 bulk_ignore_pyright_warnings.py
+1 −1 firebase
+1 −1 helm/Chart.yaml
+1 −0 main/cache.py
+1 −1 main/config.py
+12 −0 main/cronjobs.py
+11 −0 main/settings.py
+91 −43 project_types/base/project.py
+25 −6 project_types/base/tutorial.py
+21 −10 project_types/street/api_calls.py
+8 −7 project_types/street/project.py
+7 −5 project_types/tile_map_service/base/project.py
+22 −13 project_types/tile_map_service/compare/project.py
+30 −1 project_types/tile_map_service/completeness/project.py
+14 −0 project_types/tile_map_service/find/project.py
+58 −26 project_types/validate/project.py
+1 −1 project_types/validate_image/project.py
+3 −2 pyproject.toml
+1 −1 release.sh
+12 −10 schema.graphql
+2 −2 utils/geo/tile_functions.py
+1 −1 utils/geo/transform.py
+75 −64 utils/graphql/drf.py
+19 −0 utils/graphql/inputs.py
+24 −22 uv.lock