Fix for #85 - Sending BadRequest error when getBallots is called with ballotVisibility hidden
This solves the issue mentioned in #85 (closed)
I've added a if else to check whether the ballotVisibility is set to hidden
if(ballotVisibility != 'hidden')
respond with ballots array
else
respond with BadRequest error message -> "Ballots are kept hidden for this election"
Here's the screenshot of response.
I've tested this code under two conditions.
- When ballotVisibility is visible or public where it returns with ballots array with ballots information
- When ballotVisibility is hidden where it returns with BadRequest error message -> "Ballots are kept hidden for this election" as shown in the screenshot above