Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report re-opened through questionnaire without comment #2357

Closed
joesiltberg opened this issue Dec 18, 2018 · 3 comments · Fixed by #2361
Closed

Report re-opened through questionnaire without comment #2357

joesiltberg opened this issue Dec 18, 2018 · 3 comments · Fixed by #2361
Assignees
Labels

Comments

@joesiltberg
Copy link
Contributor

Describe the bug
We've noticed a few issues recently where a body has marked a report as Fixed, yet it shows up as still Open.

It looks like this when viewing the report:

solvedornot

The only update in the report is from the body, which has marked the report as Fixed (circled in the picture - "Löst" in Swedish). The map pin shows it as open, and there's no fixed banner at the top right of the report frame.

Checking the problem state in the database:

fixmystreet=> SELECT state FROM problem WHERE id = 10766;
   state
-----------
 confirmed
(1 row)

Checking the updates:

fixmystreet=> SELECT id, created, text, problem_state FROM comment WHERE problem_id = 10766;
  id   |          created           |                      text                      |  problem_state
-------+----------------------------+------------------------------------------------+-----------------
 17435 | 2018-12-03 08:58:29.936004 | Uppsatt på asfalteringslista. /Forshaga kommun | fixed - council
(1 row)

Checking the questionnaires:

fixmystreet=> SELECT * FROM questionnaire WHERE problem_id = 10766;
  id   | problem_id |          whensent          |       whenanswered        | ever_reported |    old_state    | new_state
-------+------------+----------------------------+---------------------------+---------------+-----------------+-----------
 11758 |      10766 | 2018-12-05 08:52:04.496757 | 2018-12-06 19:54:27.02879 |               | fixed - council | confirmed
(1 row)

So it seems the reporter has re-opened the report through the questionnaire. This doesn't show up in the updates however.

According to https://fixmystreet.org/running/surveys/ the reporter needs to leave a comment when re-opening an issue:

"If the user changes the state of a problem that is currently fixed to something else, that is, they effectively re-open the problem, then the update comment is not optional."

So I suppose there should have been another row in the comment table for this report?

To Reproduce
We have been unable to reproduce. When we re-open through the questionnaire a comment is required (and that comment correctly shows up in the report)

Expected behavior
When a report is re-opened through the questionnaire, it should be visible among the updates for the report.

Additional context
FixaMinGata is currently running v2.3.4 of FixMyStreet.

Any tips on how I can investigate this further, or something I can try in order to reproduce, would be much appreciated!

@dracos
Copy link
Member

dracos commented Dec 18, 2018

Thanks for the detailed report :)

#1998 changed the process so that a basic questionnaire response is recorded as soon as the link in the email is clicked (in case they don't then fill in the form at all). This means there is no associated update if that happens. However, in that situation, a report page should still list questionnaire responses without associated updates (see the load_updates function in Report.pm), so it sounds like there's a bug. It looks like it is only looking for questionnaire responses that kept the same state and that state was open/closed, so that it can say "Still open, via questionnaire", ignoring other states, which sounds wrong...

@joesiltberg
Copy link
Contributor Author

Did #1998 intend to relax the requirement that a comment is needed when re-opening a report? If so I agree it seems load_updates looks wrong since it's making the assumption that state change implies a comment.

How about if load_updates, instead of looking at whether the state was changed in the questionnaire, includes those entries from the questionnaire table for which there isn't an entry in the comment table (using the 'questionnaire_id' extra meta data in the comment table)? So we'll start with all entries from the questionnaire table and filter out those with ids found in the comment table.

Then load_updates is not making any assumptions about when a questionnaire has a comment.

For the basic questionnaire response recorded as soon as the link is clicked, before the form has been properly filled in and submitted, what do we expect new_state to be?

@dracos
Copy link
Member

dracos commented Dec 19, 2018

Yes, load_updates is wrong, that's the bug, exactly as you say. A questionnaire response new_state will be:

  • unknown if they clicked Unknown;
  • fixed - user if they clicked Yes and current problem is an open/closed state;
  • confirmed if they clicked No and current problem is a fixed state;
  • otherwise the same as the current problem state.

load_updates only currently looks at the last of these for open/closed states. It should also look at the 2nd/3rd lines, those are the missing ones if I've read it correctly - any where new state is confirmed (line 3) and any where new state is fixed - user and old state not fixed - user (line 2). That would cover the one you opened the ticket about, which is a line 3 example.

@dracos dracos added the Bug label Dec 19, 2018
@dracos dracos mentioned this issue Dec 19, 2018
2 tasks
@ghost ghost assigned dracos Dec 19, 2018
@ghost ghost added the In progress label Dec 19, 2018
@ghost ghost added Reviewing and removed In progress labels Dec 20, 2018
@ghost ghost removed the Reviewing label Dec 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants