Skip to content

Commit

Permalink
use campaign max members for team max generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Šimon Macek committed Dec 25, 2024
1 parent d683840 commit 45e329b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/form/FormFieldSelectTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ export default defineComponent({
</div>
<div class="d-flex gap-4" data-cy="member-icons">
<q-icon
v-for="i in 5"
v-for="i in item.maxMembers"
:key="i"
name="circle"
size="8px"
Expand Down
6 changes: 5 additions & 1 deletion src/composables/useApiGetTeams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { rideToWorkByBikeConfig } from '../boot/global_vars';

// stores
import { useLoginStore } from '../stores/login';
import { useChallengeStore } from '../stores/challenge';

// types
import type { Logger } from '../components/types/Logger';
Expand All @@ -32,6 +33,7 @@ export const useApiGetTeams = (logger: Logger | null): useApiGetTeamsReturn => {
const teams = ref<OrganizationTeam[]>([]);
const isLoading = ref<boolean>(false);
const loginStore = useLoginStore();
const challengeStore = useChallengeStore();
const { apiFetch } = useApi();

/**
Expand Down Expand Up @@ -124,7 +126,9 @@ export const useApiGetTeams = (logger: Logger | null): useApiGetTeamsReturn => {
label: team.name,
value: team.id,
members: team.members,
maxMembers: rideToWorkByBikeConfig.defaultMaxTeamMembers,
maxMembers: challengeStore.getMaxTeamMembers
? challengeStore.getMaxTeamMembers
: rideToWorkByBikeConfig.defaultMaxTeamMembers,
};
});
};
Expand Down
5 changes: 4 additions & 1 deletion src/stores/challenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export const useChallengeStore = defineStore('challenge', {
},

actions: {
setMaxTeamMembers(maxTeamMembers: number | null): void {
this.maxTeamMembers = maxTeamMembers;
},
async loadPhaseSet(): Promise<void> {
const { campaigns, loadCampaign } = useApiGetCampaign(this.$log);
await loadCampaign();
Expand Down Expand Up @@ -137,6 +140,6 @@ export const useChallengeStore = defineStore('challenge', {
},

persist: {
pick: ['phaseSet'],
pick: ['daysActive', 'maxTeamMembers', 'phaseSet'],
},
});

0 comments on commit 45e329b

Please sign in to comment.