Issue with survey macro - data lost after migration
Asked by Hans-Peter Geier:

(I think this question should go best to frank-stiller)

Hi, We have recently upgraded the survey and vote plugin from version 1.1 to 2.6 and then to 2.7.

Now we notice that some (but not all) pages are missing the survey votes and comments.

I had a look into the sql table, there I can see that the survey's responses are still there, but they are not shown in their page.

I already validated that the entity_id maches the page_id, and the name of the survey has not been changed, so I don't understand what's the problem.

Please help.

The sql table content for example looks like this:

{code}

confluence_ContentEntityObject \| 24348640 \| vote.How do you feel about the team during sprint 22?. 5 - neutral \| 6 \| f \| 0 \|   
\| Olexij.Tkatchenko,roroeder \| 0 \| 0 \|   
confluence_ContentEntityObject \| 24348640 \| vote.How do you feel about your role in the team during sprint 22?. 5 - neutral \| 6 \| f \| 0 \|   
\| Olexij.Tkatchenko,roroeder,eduardle \| 0 \| 0 \|   
confluence_ContentEntityObject \| 24348640 \| survey.How do you feel about your role in the team during sprint 22?.comment.eduardle \| 6 \| f \| 0 \|   
\| feel having too little insight/knowledge about current development on git side. Hopefully, it will change after the knowledge session... \| 0 \| 0 \|   

{code}

(there is more data but I don't want to paste it into a public visible page)

In Confluence, the survey appears as if nobody has voted yet.


Answers:
author: Hans-Peter Geier
body: hey Atlassian, fix your software!!

I have several times already pressed the "Answer your own question" button, but it is still remining me that this is not answered yet.


author: Hans-Peter Geier
body: hmm, I'm trying to set the status of this question to Answered, but it does not change.


author: Hans-Peter Geier
body: see my last comment


author: Hans-Peter Geier
body: I figured that existing data had a space not only between . and the vote, but also behind the last character of the vote.

I removed all these spaces.

Another difficulty was that the confluence server seems to cache the whole table in memory, so my data changes did not have the expected effect at a glance. It took me a while to find out that I have to flush the cache (system admin) to make data changes appear in the survey result.

After having gone across all that hurdles, the survey results created by the older versions of the plugin are now available again.

What a pain! Hope this doesn't happen again.


author: Frank Stiller
body: hi Hans-Peter,

first i would recommend to use the label for this plugin, i probably only got notified as i am following the "survey" label.

Regarding the actual question, in newer version there is a space truncated which in older versions somehow was not. Can you replace the following key as a try?

```
vote.How do you feel about your role in the team during sprint 22?. 5 - neutral
```

with

```
vote.How do you feel about your role in the team during sprint 22?.5 - neutral
```

The space after the concatenating . before the actual choice should be trimed. Can you do that in your database? if you tell my your sql dialect i can probably provide a appropriate sql update command. That would be my recommended solution. There is currently another user having the same issue: <https://github.com/drohne1673/confluence-survey-plugin/issues/32>

comments: author: Hans-Peter Geier
body: Hi Frank,

sorry, I'm not sure which label is the right one. There were several suggestions when I typed "survey" into the "tags" field.

I'm using postgresql.

The user has used the following content in the "New default choices" field:

10 - everything is perfect, 9 , 8 , 7 , 6 , 5 - neutral , 4 , 3 , 2 , 1 - nothing works

Note the spaces before and after the comma.

The old version of the plugin created votes in the database like the first one (a space between . and the number)

A new survey (created using the new plugin version), using the same choices with spaces before and after each comma, created database rows without space between the . and the number. (data of this new survey is shown correctly)

So I believe your assumption regarding the space leads into the right direction.

I modified the votes record of one survey and manually removed this space from the database records.

e.g.

{code}

confluence_ContentEntityObject \| 24348640 \| vote.How do you feel about the team during sprint 22?.5 - neutral \| 6 \| f \| 0 \| \| Olexij.Tkatchenko,roroeder \| 0 \| 0 \|   
confluence_ContentEntityObject \| 24348640 \| vote.How do you feel about the team during sprint 22?.8 \| 6 \| f \| 0 \| \| Andreas.Krey,eduardle \| 0 \| 0 \|   
confluence_ContentEntityObject \| 24348640 \| vote.How do you feel about the team during sprint 22?.6 \| 6 \| f \| 0 \| \| christopher.dear \| 0 \| 0 \|   
confluence_ContentEntityObject \| 24348640 \| vote.How do you feel about the team during sprint 22?.7 \| 6 \| f \| 0 \| \| winfried.merz,raphael.bachmann,josef.guettlein,Zhi-Wei.Xu \| 0 \| 0 \|   
{code}

Though, the votes still do not show up in the survey plugin output.

maybe there are also spaces behind the digit which need to be removed?

I suppose it would be the best if you could provide a patch to the plugin which handles the space issue in a tolerant way (with or without spaces in the choices entry, and with and without spaces in the database)


author: Frank Stiller
body: when i click on "ask a question" on the support page of the plugin it suggests something like

```
addon-com.nearinfinity.confluence.survey-plugi
```

doesnt look beautiful, but thats what atlassian asigned to it.

The problem is that the plugin also needs to know exactly what the migration path is otherwise it will have to handle lots of possibilities and in the worst case all of them have data stored. So as it should be a onetime operation in the database i would still prefer we find the sustainable solution.

sorry for the inconvenience. Can you tell me which confluence version you updated the plugins? so it was stored with a survey plugin 1.1.8 and you are trying to read via 2.\*, i try to reproduce that

Edit:

After some experimentation i would suggest another try. Could you please copy the content of the survey to another page and vote with exactly the same items again? And then compare the old data with the new ones. They shouldnt be equal as you said the dont show up in the "migrated" survey. I would like to see the difference, as i could not find real differences myself. One of the findings so far were more whitespaces in form of "none-breaking-whitespace" (\\u00a0)


author: Hans-Peter Geier
body: I'll do the experiment and let you know.


author: Hans-Peter Geier
body: the version of the plugin before upgrade was 1.1.8.8. We migrated to 2.6.0

Issue occured on both, Confluence 4.3.7 and 5.4.4


author: Frank Stiller
body: i have a confluence 5.5 installation and added the plugin 1.1.8.8. I added some vote and survey macros then updated to the latest 2.7.0 plugin version.

All survey macros with custom choices had some whitespaces somehow. Vote macros seemed to be fine. I removed the spaces in the database as already recommended and had to restart confluence so the macro were reloaded correctly. After that everything seemed as expected.

Did you already try to restart your confluence installation? Would it be a feasible solution for you?


author: Hans-Peter Geier
body: I had not restarted confluence so far, because plugin updates usually don't require this.

Last weekend I have restarted confluence (and also cleared the plugin cache).

Regrettably the issue still exists.


author: Frank Stiller
body: I guess the restarting is a special case, as i modified my hsql database (which is just a textfile).
> As previously suggested: could you please copy the macro which should show up data to another page and vote on some items. Then check the database and copy the key's as you did in the first post, so we can check the difference.

I cant really reproduce the behaviour, it is just a issue with spaces and when i copy your example i get other html codes like none-breaking spaces.


Tags: confluence-administration

survey