Correcting a little error in the error system
This commit is contained in:
1 parent
d2c99cbc8a
commit
13ad9b4e39
2 files changed
+4
-2
No files matched your search
@@ -25,7 +25,7 @@ const resolve = (parent, { eventDesignator, rank, amount }, context) => {
|
||||
} else if (!event) {
|
||||
reject(new DatabaseError('None of the events you own respond to that designator'))
|
||||
} else {
|
||||
let prizeIndex
|
||||
let prizeIndex = null
|
||||
event.prizes.find((prize, index) => {
|
||||
if (prize.rank === rank) {
|
||||
prizeIndex = index
|
||||
@@ -33,6 +33,7 @@ const resolve = (parent, { eventDesignator, rank, amount }, context) => {
|
||||
})
|
||||
if (!prizeIndex) {
|
||||
reject(new DatabaseError('There is no prize for that index'))
|
||||
return
|
||||
}
|
||||
event.prizes[prizeIndex].amount = amount || event.prizes[prizeIndex].amount
|
||||
event.save((err) => {
|
||||
|
||||
@@ -26,7 +26,7 @@ const resolve = (parent, { eventDesignator, title, newtitle, description }, cont
|
||||
} else if (!event) {
|
||||
reject(new DatabaseError('None of the events you own respond to that designator'))
|
||||
} else {
|
||||
let ruleIndex
|
||||
let ruleIndex = null
|
||||
event.rules.find((rule, index) => {
|
||||
if (rule.title === title) {
|
||||
ruleIndex = index
|
||||
@@ -34,6 +34,7 @@ const resolve = (parent, { eventDesignator, title, newtitle, description }, cont
|
||||
})
|
||||
if (!ruleIndex) {
|
||||
reject(new DatabaseError('There is no rule with that title'))
|
||||
return
|
||||
}
|
||||
event.rules[ruleIndex].description = description || event.rules[ruleIndex].description
|
||||
if (event.rules.some(rule => rule.title === newtitle)) {
|
||||
|
||||
Reference in new issue
Block a user