MieuxVoter/majority-judgment-api-python

an election with end date before start date should not be possible

njourdane opened this issue · 4 comments

Issue and Steps to Reproduce

Create a new election, select the same date for start and stop, but the end hour before the start hour:

2020-05-19_15-05-1589893525

Version

on app.mieuxvoter.fr, as of 19/05/2020.

Expected

The confirmation button should not be clickable and it should not be possible to create this election.

Actual

The election is created.

Hi, this is not a back problem but a front problem. You have to move this issue to MieuxVoter / mvfront i think.

It is also a back issue. Here I create an election beginning today and ending on july 14th, 1789, with any error:

curl 'https://demo.mieuxvoter.fr/api/election/' --header "Content-Type: application/json" --request POST --data  '{"title":"x","candidates":["a","b"],"on_invitation_only":false,"num_grades":7,"elector_emails":[],"start_at":1589967207,"finish_at":-5694969600,"select_language":"en","front_url":"https://app.mieuxvoter.fr","restrict_result":false}'

Dates are not verified at all. Creating an election starting or ending before today must not be possible too.

Uh, no
Because the back only intervenes after the validation of the election. So yes we can do the verification in the back, but the user will be warned of the problem only after the validation of his election, which gives a very bad user experience, I think

I don't understand your point of view.

When I create an election ending on july 14th, 1789, I expect the server to answer something like error 400: bad date, not Oh of course, please take your election id.