git ssb

0+

Piet / ssb-loomio



Commit f9c8608d388933583c65f43ed6750ec4832159db

Integrates new error stuff into chooseOneResults

Piet Geursen committed on 3/8/2018, 3:27:14 AM
Parent: 468d684bfde5b5b265ab076477d4c4930e4d8dc8

Files changed

position/sync/chooseOneResults.jschanged
position/sync/chooseOneResults.jsView
@@ -1,6 +1,7 @@
11 const isArray = require('isarray')
2-const {ERROR_POSITION_CHOICE, ERROR_POSITION_TYPE, ERROR_POSITION_LATE} = require('../../types')
2+const positionChoiceError = require('../../errors/sync/positionChoiceError')
3+const positionLateError = require('../../errors/sync/positionLateError')
34
45 // Expects `poll` and `position` objects passed in to be of shape:
56 // {
67 // key,
@@ -17,16 +18,14 @@
1718 const { author, content } = position.value
1819 const { choice } = content.positionDetails
1920
2021 if (isInvalidChoice({position, poll})) {
21- // TODO change this to push errors into poll.errors
22- results.errors.push({type: ERROR_POSITION_CHOICE, position})
22+ results.errors.push(positionChoiceError({position}))
2323 return results
2424 }
2525
2626 if (isPositionLate({position, poll})) {
27- // TODO change this to push errors into poll.errors
28- results.errors.push({type: ERROR_POSITION_LATE, position})
27+ results.errors.push(positionLateError({position}))
2928 return results
3029 }
3130
3231 // TODO convert from Array to Object

Built with git-ssb-web