• When exporting poll votes to CSV (Poll Results – View votes – Export), the question and all answers per voter are all exported in the same cell (same column named Vote data) of the CSV output file. It makes the export table a bit mess. I suggest to divide the vote data into separate cells – separate columns: a column for the question, another column for answer1, another column for answer2 (if exists), etc. For example:
    Vote data 0 (Question), Vote data 1 (Answer1), Vote data 2 (Answer2), etc.
    I have tried myself and managed to separate the question from the answers (but so far all answers in the same column):
    …/plugins/yop-poll/admin/models/votes.php :

    line 1390:
    __( ‘Vote data 0’, ‘yop-poll’ ),
    __( ‘Vote data 1’, ‘yop-poll’ ) //line added

    line 1398:
    $details_string = ”;
    $details_string2 = ”; //line added

    line 1405:
    $details_string .= __( ‘Question’, ‘yop-poll’ ). ‘: ‘ . addslashes( $res[‘question’] ) ; //line modified
    foreach ( $res[‘answers’] as $ra ) {
    $details_string2 .= __( ‘Answer’, ‘yop-poll’ ) . ‘: ‘ . addslashes( $ra[‘answer_value’] ) . ‘;’; //line modified

    line 1418:
    stripslashes( $details_string ),
    stripslashes( $details_string2 ) //line added

    If you agree you might also separate the answers (if multiple) and make it into your core.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author YOP

    (@yourownprogrammer)

    @ssebech thank you for your suggestion.

    We are currently working on this and would like to know your thoughts on how the export should look like when allowing multiple answers per question.

    Looking forward to hearing from you.

    Thank you.

    Thread Starter Stefan Sebechlebsky

    (@ssebech)

    @yourownprogrammer well, I have meant that each answer should be in a separate cell (column). But now I understand…, you mean the details ??

    Approach 1:
    Perhaps, there could be a separate column per each answer in the exported table, even in case of single answer per question allowed. Of course, there is one column also for the question. Instead of “Vote data” the headings should be: “Question”, “Answer1”, “Answer2”, etc. The values in the table body would correspond to the text (string) of the question and each answer selected by the voter. Unselected answer would be represented by empty cell (no value). Example:

    … Username … Question Answer1 Answer2 Answer3
    … MyVoter1 … How_are? <empty> poorlyo <empty>
    … MyVoter2 … How_are? perfect <empty> lovelyo
    … MyVoter3 … How_are? perfect <empty> <empty>

    So this would be universal for both single and multiple answers per question allowed and clearly seen which answer(s) chosen by each voter and what was the question he answered.

    Approach 2:
    Mention the question and all possible answers (give a number to each one) before the table heading and in the table body use “1” per each answer selected, and empty cell <e> if not selected. Question column not necessary:

    Question: How are you feeling baby right now?
    An1: Perfectly drunk.
    An2: Completely tired.
    An3: Absolutely happy.
    ———————————–
    … Username … An1 An2 An3
    … MyVoter1 … <e> -1- <e>
    … MyVoter2 … -1- <e> <e>
    … MyVoter3 … <e> <e> -1-

    This way admin can easily sum the votes per answer automatically.., although not all clearly seen at first sight how who voted.

    If you could make it optional to the admin when exporting the table whether he choose Approach 1 or Approach 2 that would be perfect.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Suggestion: separate question and answers in CSV votes export’ is closed to new replies.