Skip to content

Allow 1 volunteer to submit report - #103

Open
NicholasT1 wants to merge 14 commits into
masterfrom
feat/revamp-reports
Open

Allow 1 volunteer to submit report#103
NicholasT1 wants to merge 14 commits into
masterfrom
feat/revamp-reports

Conversation

@NicholasT1

@NicholasT1 NicholasT1 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Changes

  • Add steps and migrations for easier setup of local supabase instance
  • Remove user_id column from observation table
  • Remove queries using user_id for observation table
  • Remove other reports in group report view

Note

  • DB migrations for this PR have not been run yet on shared Supabase remote since it is a breaking change (Will run after this is merged)
  • Can test by starting and connecting to local Supabase instance (It should start without issues, with seeded data that is copied from our shared Supabase remote), this instance will have all the DB migrations for this PR

After this PR

Closes #104

@NicholasT1
NicholasT1 force-pushed the feat/revamp-reports branch from 00c7b57 to 75e6f14 Compare June 30, 2026 12:58
Comment thread supabase/migrations/20260719122751_change_observation_schema.sql
Comment thread supabase/seed.sql

@NicholasT1 NicholasT1 Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seeded data obtained after db_dump on our shared supabase remote, then applying the migrations from this PR

@NicholasT1
NicholasT1 marked this pull request as ready for review July 7, 2026 14:51
@NicholasT1 NicholasT1 self-assigned this Jul 7, 2026
@seanlim

seanlim commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Hi @NicholasT1, can you rebase on master?

@NicholasT1
NicholasT1 force-pushed the feat/revamp-reports branch from 675ef0a to ddd8ba7 Compare July 9, 2026 15:50
Comment thread supabase/seed.sql

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that migrations run successfully and data is seeded properly

@ngkhengyang ngkhengyang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will be better if the PR addresses both #104 and #105 at the same time since both are closely related and involve database changes. Meanwhile, it avoids leaving extra code comments (for example)

Comment thread README.md

### Prerequisites

- Docker Desktop (must be running)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attempted to run local supabase and as another prerequisite required, google client id and secret are required as part of google auth provider. The supabase/config.toml file needs to be configured accordingly with those keys as well.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's super necessary for now since we can just login with email directly and the google login flow shouldn't need testing locally

submittedAt: string
reporters: string[]
submittedCount: number
// submittedBy: string

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment needed?

: { data: [] }

const currentRoundSlotIds = (currentRoundSlots || []).map((slot) => slot.id)
const currentRoundUserSlotIds = currentRoundSlotIds.filter((id) => userSlotIds.includes(id))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of filtering here, maybe you can optimize this a little by adding a .in('slot_id', userSlotIds) clause in the db query for currentRoundSlots? db query is more optimized for this.

return next
})
}
const myObservation = observations

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this re-assignment needed?

roundName: string
}
observations: ObservationData[]
observations: ObservationData

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
observations: ObservationData
observation: ObservationData

Perhaps renaming the prop into a singular form (or myObservation) may be more appropriate?

.select('user_id, status, profiles:user_id(full_name, email)')
.eq('slot_id', data.slot_id)

const membership = (memberships || []).find((m) => m.status === 'ACTIVE') as { user_id: string; profiles: { full_name: string | null; email: string } | null } | undefined

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of one of the active members, I think this can display all active memberships instead since we are going under the assumption where all of them contributed to one single report (you may indicated who submitted the report when you handle #105 )

Comment thread lib/types/database.ts
},
} as const

// Convenience type aliases used throughout the app. These are pure type

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I'm aware, there are several files that referenced imports for these types, so the deletion of these convenience type aliases will create compiler errors (use npx tsc --noEmit to check).

@seanlim

seanlim commented Jul 16, 2026

Copy link
Copy Markdown
Owner

@NicholasT1 this PR is kinda huge, you might want to cherry pick the local supabase dev setup stuff (base migrations, seed, readme and config changes) into a separate branch so we can get that merged first!

@NicholasT1

Copy link
Copy Markdown
Collaborator Author

I think it will be better if the PR addresses both #104 and #105 at the same time since both are closely related and involve database changes. Meanwhile, it avoids leaving extra code comments (for example)

I think this PR is already quite big and for now, I might not have much time to work on this. Not ideal to leave comments but I feel if another team member has the bandwidth to work on #105, it would be preferable to waiting for me to eventually finish it.

@NicholasT1
NicholasT1 force-pushed the feat/revamp-reports branch from ddd8ba7 to b20608f Compare July 19, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change observations to 1 observation per slot

3 participants