DemocracyClub / candidate_questions

BSD 3-Clause "New" or "Revised" License
1 stars 3 forks source link

Receive questions to answer in batches #8

Open graphiclunarkid opened 9 years ago

graphiclunarkid commented 9 years ago

So that I am not overwhelmed by questions from Organisations arriving continuously As a Candidate I want to receive questions in batches

Scenario: A candidate visits the site Given there are one or more Questions that I have not yet answered And I have indicated I am willing to participate When I visit the site Then I should be asked some of the questions I have not yet answered.

Scenario: there are no more questions to answer Given I have answered every question When I visit the site Then I should be told there are no more questions

Scenario: I was last invited to answer questions more than N days ago Given there are one or more Questions that I have not yet answered And I have indicated I am willing to participate When it has been more than N days since I last visited the site Then I should be invited to visit the site and answer some more questions

dantheta commented 9 years ago

I've done a basic question answering screen here: https://github.com/dantheta/candidate_questions/tree/feature/candidate_questions

To help keep track of how many outstanding questions have been shown to a candidate, I was thinking that the system could create empty answer records associating a question and a candidate, and as they complete them a "completed" flag on the answer gets set. The database has visibility of which questions still require answers, and maintain a set of /n/ unanswered questions. We can shuffle questions from different organisations into the "open questions" set for each candidate (possibly with a cron job, or as the candidates answer).

The answering screen could also allow the candidate to skip a question (declining to answer), by leaving the answer field in the DB blank but setting the completed flag nonetheless.

The code that is on the branch is basically (and minimally) functional, but needs re-organizing since the prototype app has been split up.

EdwardBetts commented 9 years ago

Great work.

I think the Candidate model needs to subclass TokenAuthModel so we can use the authentication in token_auth. That means both Organisation and Candidate have a one-to-one mapping to the User model. Each Candidate or Organisation should have a matching User with a username. Any idea how we generate these names?

EdwardBetts commented 9 years ago

To answer my own question. We can generate usernames that start "candidate-" followed by the popit ID.

dantheta commented 9 years ago

Cool - I'll get that branch reorganized to fit together with the new separate apps.

As for usernames: for organisations, I think it should be enough to replace spaces in the name with underscores and lowercase to create an initial username. For candidates we can go with firstname - underscore - lastname, lowercase, and then suffix a counter (or maybe constituency) in case of duplicates.

They'd be more meaningful to the users, which might be a plus.

dantheta commented 9 years ago

I think the first two scenarios are covered by the answers page as it is (I have made it a bit prettier in a recent commit).

It looks like some email-handling code has appeared in the repo, so I may have a go at doing another manage script to send email reminders to candidates who've already agreed to participate inviting them to return to the site.

dantheta commented 9 years ago

Pull request submitted to the 89up fork for email reminders.