Score:0

How can I display user information along with its choices?

de flag

Usually, polls are anonymized. We need to process total votes, percentages... Now, in the context of Ukraine invasion, an institutional client wants to enhance an Advanced poll existing implementation, in order to collect citizens' data about their possibilities to host families, help with donations, and so on. And of course to reach out to the people who answered the questions...

While this could certainly be done with Webform, the team is used to poll UI, everything's already in place... and we need to go fast.

I couldn't build a poll Views with relationships and retrieve the voters' ID, emails... or the other way down from users to its poll votes... It seems that Views cannot map poll choices / results with the users who voted.

The poll_vote table contains the core info for that feature, with a chid field (the choice ID), a poll ID pid, and uid. The choice label can be then retrieved from poll_choice_field_data table...

Should I extend : `Drupal\poll\PollViewData\ with a couple of Views field handler plugins, and how ?

Not sure what would be a straightforward way to solve this. Maybe I'm missing the point ? Any help, code starter, is warmly welcome to solve this quickly. Thanks

No Sssweat avatar
ua flag
See https://www.drupal.org/project/poll/issues/3180178
Score:0
cn flag

To solve it quickly, I would use Webform. Webform already does everything you need and is widely use (one of the most popular contrib modules).

The problem is that Poll is designed to be a one-question poll, not a full survey.

Even if your team is less familiar with Webform, the module is designed so that even non-programmers can easily make forms. I imagine that a form to collect basic personal info with some custom fields would only take an hour or two to implement assuming you already had the form design.

Alternately, if there's some problem installing a new module in the environment, I would go for Google Forms, which won't match your site design at all but is also extremely fast to implement and take down.

Kojo avatar
de flag
Thanks for your reply. I forgot to tell that I built them a full survey design on top of Poll, a simple content-type with a field to add polls, a summary... Hence the fact that I'm only missing the glue in Vievs to retrieve the user voters uid and wrap it all...?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.