Require a whole percentage for limitProb in back end
This commit is contained in:
parent
0b711be480
commit
4e1fae5b5f
|
@ -30,7 +30,15 @@ const bodySchema = z.object({
|
||||||
|
|
||||||
const binarySchema = z.object({
|
const binarySchema = z.object({
|
||||||
outcome: z.enum(['YES', 'NO']),
|
outcome: z.enum(['YES', 'NO']),
|
||||||
limitProb: z.number().gte(0.001).lte(0.999).optional(),
|
limitProb: z
|
||||||
|
.number()
|
||||||
|
.gte(0.001)
|
||||||
|
.lte(0.999)
|
||||||
|
.refine(
|
||||||
|
(p) => Math.round(p * 100) === p * 100,
|
||||||
|
'limitProb must be in increments of 0.01 (i.e. whole percentage points)'
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
})
|
})
|
||||||
|
|
||||||
const freeResponseSchema = z.object({
|
const freeResponseSchema = z.object({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user