jasonmlutz / votey

React-Rails implementation voting/poll app.
0 stars 0 forks source link

Distinguish new and completed polls #39

Open jasonmlutz opened 3 years ago

jasonmlutz commented 3 years ago

The current pipeline for creating a poll takes the following sequence:

  1. Create a poll object (with title, description, author)
  2. Get redirected to the QuestionNew component (params: poll_id)
  3. See the existing poll (with questions and response options)
  4. Create a new question
  5. Create new response option(s)
  6. return to 4 and repeat

This structure will not distinguish between existing and newly created polls. This could be leveraged to make editing polls easier, though the only edit feature this would help is 'add new questions' or 'add new response options to the most recent question'.

Possible solutions:

  1. Add a completed or locked flag to indicate when a poll has left initial creation status.
  2. ???
jasonmlutz commented 3 years ago

This difference will also help in the following situation: A poll is created, but it is not ready for submissions, perhaps due to one of the following:

  1. it has no questions
  2. it has at least one question with no response options
  3. it has at least one question with exactly one response option

Then this poll should be left in the editable state, rather than a response-ready state, allowing additions but preventing responses.

This would require some complex validations. For example:

  1. A response object can not be created with poll_id of a poll which is not response-ready.
  2. A poll may not be flagged as response-ready if any of the above 3 conditions apply.
jasonmlutz commented 3 years ago

See #44, #18 .