Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WG opening listing sorted in chronological order (#2513) #4191

Open
wants to merge 16 commits into
base: dev
Choose a base branch
from

Conversation

chrlschwb
Copy link
Contributor

fixes #2513
I have closed the old PR, #3862.
This is the new PR based on the recent dev branch.

@vercel
Copy link

vercel bot commented Feb 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
dao ✅ Ready (Inspect) Visit Preview Oct 27, 2023 5:57pm
pioneer-2 ✅ Ready (Inspect) Visit Preview Oct 27, 2023 5:57pm
pioneer-2-storybook ✅ Ready (Inspect) Visit Preview Oct 27, 2023 5:57pm

@thesan
Copy link
Member

thesan commented Mar 3, 2023

@chrlschwb

The goal of issue #2513 is to sort openings according to "created date", not by "end date". It's true that created date is displayed nowhere in the UI, but that's irrelevant to the issue. Maybe we can add "created date" of openings as a new column.

I understand that but in the comment I was questioning weither there was an issue in the first place. Could you link to an example please ?

Also to fix the CI please reverse the change on packages/ui/src/working-groups/queries/__generated__/workingGroups.generated.tsx

Copy link
Contributor

@traumschule traumschule left a comment

Choose a reason for hiding this comment

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

| ERROR in src/working-groups/hooks/useOpeningsPagination.ts:30:5
--
13:16:25.045 | \| TS2322: Type 'WorkingGroupOpeningOrderByInput.CreatedAtDesc[]' is not assignable to type 'InputMaybe<WorkingGroupOpeningOrderByInput> \| undefined'.
13:16:25.045 | \|   Type 'WorkingGroupOpeningOrderByInput.CreatedAtDesc[]' is not assignable to type 'WorkingGroupOpeningOrderByInput.UpdatedAtDesc'.
13:16:25.045 | \|     28 \|     offset: (page - 1) * OPENINGS_PER_PAGE,
13:16:25.045 | \|     29 \|     where,
13:16:25.045 | \|   > 30 \|     order: [WorkingGroupOpeningOrderByInput.CreatedAtDesc],
13:16:25.045 | \|        \|     ^^^^^
13:16:25.045 | \|     31 \|   }
13:16:25.045 | \|     32 \|
13:16:25.045 | \|     33 \|   const { data, loading, error } = useGetWorkingGroupOpeningsQuery({ variables })
13:16:25.045 | \|
13:16:25.045 | \| webpack 5.64.3 compiled with 1 error in 106165 ms

@@ -722,7 +722,7 @@ export type CountWorkingGroupWorkersQuery = {

export type GetWorkingGroupOpeningsQueryVariables = Types.Exact<{
where?: Types.InputMaybe<Types.WorkingGroupOpeningWhereInput>
order?: Types.InputMaybe<Array<Types.WorkingGroupOpeningOrderByInput> | Types.WorkingGroupOpeningOrderByInput>
order?: Types.InputMaybe<Types.WorkingGroupOpeningOrderByInput>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
order?: Types.InputMaybe<Types.WorkingGroupOpeningOrderByInput>
order?: Types.InputMaybe<Array<Types.WorkingGroupOpeningOrderByInput> | Types.WorkingGroupOpeningOrderByInput>

@@ -27,7 +27,7 @@ export const useOpeningsPagination = ({ groupId, type, page = 1 }: UseOpeningsPa
limit: OPENINGS_PER_PAGE,
offset: (page - 1) * OPENINGS_PER_PAGE,
where,
order: [WorkingGroupOpeningOrderByInput.CreatedAtDesc, WorkingGroupOpeningOrderByInput.RuntimeIdDesc],
order: [WorkingGroupOpeningOrderByInput.CreatedAtDesc],
Copy link
Member

Choose a reason for hiding this comment

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

If I understand correctly this #2513 (comment), the issue is that the openings are ordered by ascending creation date. So this line (order: [WorkingGroupOpeningOrderByInput.CreatedAtDesc, WorkingGroupOpeningOrderByInput.RuntimeIdDesc] looks fine to me, but the problem is still not solved on the preview branch /working-groups/openings:
image

So I'm guessing that maybe this useOpeningsPagination is used to query the openings on a different page. E.g on the WG past openings page the order is correct even in production.

In conclusion I think this change should be reversed and either the hook used to query /working-groups/openings should be fixed or an even better solution would be to reuse the same hook to query openings everywhere.

Also please get reviews from BWG workers before setting jsg-code-review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-dev issue suitable for community-dev pipeline
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[USERSNAP] Working Groups: Openings not listed chronologically
3 participants