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

1481 implement similar positions on recruitmentapplicationformpage #1596

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

Snorre98
Copy link
Contributor

@Snorre98 Snorre98 commented Nov 3, 2024

What

  • Created backend and frontend for fetching positions from tags. This makes it possible to fetch positions similar to each other.

  • Modified seed script to create more realisitc tags.

  • Fixes some rendering issues on RecruitmentApplicationFromPage

  • Bette styling will be done in another PR. The entire page should get a glow-up.
    bilde

Why

Fetching similar positions is a feature on Samf3

closes #1481

@Snorre98 Snorre98 linked an issue Nov 3, 2024 that may be closed by this pull request
@Snorre98 Snorre98 self-assigned this Nov 3, 2024
Copy link
Contributor

@Mathias-a Mathias-a left a comment

Choose a reason for hiding this comment

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

Ikke testa, tror ikke det funker, men kan da ikke være så ille heller

Copy link
Contributor

Choose a reason for hiding this comment

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

Kan kanskje være litt forvirrende om navn og tags ikke stemmer? Ikke så farlig for meg assa

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Skjønner ikke helt hva du mener. Samme "kategori" av tags har en "stillings navn prefik", så det skal ikke bli mismatch mellom navn og tag.

Comment on lines +1360 to +1361
recruitment_id = self.kwargs.get('id')
tags_param = self.request.query_params.get('tags')
Copy link
Contributor

Choose a reason for hiding this comment

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

Funker det ikke å bruke getlist her?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hvis jeg forstår det riktig må klienten sende queryparams på denne måten: ?tags=tag1&tags=tag2&tags=tag3 hvis man skal bruke getlist

Gitt at tags i denne implementasjonene er lagret i en komma separert string må man uansett formatere dataen på et elle annet tidspunkt. Om man skulle brukt getlist må man gi API kall funksjonen tags: string[]

og formatere url med params på denne måten:

const tagsQuery = tags.map(t => `tags=${encodeURIComponent(t)}`).join('&');
  const url = `${BACKEND_DOMAIN}/positions?id=${recruitmentId}&${tagsQuery}&position_id=${currentPositionId}`;

Jeg tror get er den enkleste måten å gjøre det på siden tags er i en string separert med komma, men hvis noe av det over virker som at jeg ikke har forstått forskjellen på get og getlist så si ifra.

Copy link
Contributor Author

@Snorre98 Snorre98 Jan 31, 2025

Choose a reason for hiding this comment

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

For å erstatte Samf3 funksjonaliteten tror jeg dette er den enkleste måten å gjøre det på

Comment on lines 611 to 612
} as const; No newline at end of file
} as const;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed. Noe rart med generering av routes tror jeg

Comment on lines 178 to 201
{recruitmentPositionsForGang && recruitmentPositionsForGang.length > 0 && (
<div className={styles.other_positions}>
<h2 className={styles.sub_header}>
{t(KEY.recruitment_otherpositions)} {dbT(recruitmentPosition?.gang, 'name')}
</h2>
{recruitmentPositionsForGang.map((pos) => (
<Button
key={pos.id}
display="pill"
theme="outlined"
onClick={() => {
navigate({
url: reverse({
pattern: ROUTES.frontend.recruitment_application,
urlParams: { positionId: pos.id, gangId: pos.gang.id },
}),
});
}}
>
{dbT(pos, 'name')}
</Button>
))}
</div>
)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Dette kan flyttes ut i en konstant

Copy link
Contributor Author

@Snorre98 Snorre98 Jan 31, 2025

Choose a reason for hiding this comment

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

Done! Kunne sikkert lagd en helt egen komponent av det, men planen er at det skal styles bedre i et annet issue uansett.

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.

Implement similar positions on RecruitmentApplicationFormPage
2 participants