Skip to content

Commit

Permalink
fix: Default value for number winners (#4804)
Browse files Browse the repository at this point in the history
* fix: Default value for number winners

* fix

* lint

* fixes
  • Loading branch information
ChaituVR authored Jul 2, 2024
1 parent 2789c9d commit 7d4625b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/views/SpaceBoost.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const form = ref<Form>({
weightedLimit: '',
hasLotteryLimit: false,
lotteryLimit: '',
numWinners: ''
numWinners: '1'
},
network: '1',
token: undefined,
Expand Down Expand Up @@ -225,6 +225,11 @@ const strategy = computed<BoostStrategy>(() => {
eligibilityType = 'bribe';
}
const numWinners =
form.value.distribution.type === 'lottery'
? Number(form.value.distribution.numWinners)
: undefined;
return {
name: 'Boost',
description: 'Snapshot.org proposal boost',
Expand All @@ -242,7 +247,7 @@ const strategy = computed<BoostStrategy>(() => {
distribution: {
type: form.value.distribution.type,
limit: strategyDistributionLimit.value,
numWinners: form.value.distribution.numWinners || undefined
numWinners
}
}
};
Expand Down Expand Up @@ -484,7 +489,7 @@ watchEffect(async () => {
});
watch(
() => form.value.distribution,
[() => form.value.distribution.type],
() => {
if (!form.value.distribution.hasWeightedLimit) {
form.value.distribution.weightedLimit = '';
Expand All @@ -495,11 +500,12 @@ watch(
if (form.value.distribution.type === 'lottery') {
form.value.distribution.hasWeightedLimit = false;
form.value.distribution.weightedLimit = '';
form.value.distribution.numWinners ??= '1';
}
if (form.value.distribution.type === 'weighted') {
form.value.distribution.hasLotteryLimit = false;
form.value.distribution.lotteryLimit = '';
form.value.distribution.numWinners = '';
form.value.distribution.numWinners = undefined;
}
},
{ deep: true }
Expand Down

0 comments on commit 7d4625b

Please sign in to comment.