Skip to content

Commit

Permalink
fix: Update project selection limit based on project count
Browse files Browse the repository at this point in the history
  • Loading branch information
slashtechno committed Jan 23, 2025
1 parent 0a99cb7 commit c5af856
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/routes/events/[id]/rank/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
let { data } = $props();
let { event, projects } = data;
let selectedProjects: string[] = $state([]);
// let toSelect = $state(projects.length >= 20 ? 3 : 2);
let toSelect = projects.length >= 20 ? 3 : 2;
function toggleProjectSelection(projectId: string) {
if (selectedProjects.includes(projectId)) {
// If the project is already selected, remove it from the list
selectedProjects = selectedProjects.filter((id) => id !== projectId);
} else {
if (selectedProjects.length < 3) {
if (selectedProjects.length < toSelect) {
// If the project is not selected and the limit is not reached, add it to the list
selectedProjects = [...selectedProjects, projectId];
}
Expand Down

0 comments on commit c5af856

Please sign in to comment.