Skip to content

Feature/ranking question type vue3#3248

Open
datapumpernickel wants to merge 5 commits intonextcloud:refactor/vue3from
datapumpernickel:feature/ranking-question-type-vue3
Open

Feature/ranking question type vue3#3248
datapumpernickel wants to merge 5 commits intonextcloud:refactor/vue3from
datapumpernickel:feature/ranking-question-type-vue3

Conversation

@datapumpernickel
Copy link
Copy Markdown

As proposed in #1278: Add Ranking question type

Refactored to Vue3, after closing: #3247

This adds a new question type that lets respondents rank options by dragging them into order.

Results are scored using Borda count — first place gets the most points, last place gets the least. The summary shows each option's total score and average rank with a visual bar, along with a short explanation of how scoring works.

For export, ranking questions get one column per option (like grid questions do), with the rank number as the value. Answers are stored as a JSON array of option IDs, which keeps things consistent with how grid answers are stored.

There's also an optional shuffle setting.

Again disclaimer: heavy use of genAI, I did try to check the code to the best of my abilities and ran it on nextcloud-docker-dev to actually interact with it and export data.

@datapumpernickel datapumpernickel force-pushed the feature/ranking-question-type-vue3 branch 2 times, most recently from 1966d50 to ed1a5de Compare March 29, 2026 09:46
@Chartman123
Copy link
Copy Markdown
Collaborator

@datapumpernickel please don't merge the other branch into this one, use rebase:)

Adds a new 'ranking' question type that allows respondents to
drag-and-drop predefined options into their preferred order.
Based on refactor/vue3 branch, using vue-draggable-plus.

Signed-off-by: paul bochtler <65470117+datapumpernickel@users.noreply.github.com>
Signed-off-by: paul bochtler <65470117+datapumpernickel@users.noreply.github.com>
@datapumpernickel datapumpernickel force-pushed the feature/ranking-question-type-vue3 branch from 8448797 to ddfa037 Compare March 29, 2026 10:12
Signed-off-by: paul bochtler <65470117+datapumpernickel@users.noreply.github.com>
@datapumpernickel
Copy link
Copy Markdown
Author

In the current implementation, respondents drag options into their preferred order. Since there is always an order (the default one), there is no way to distinguish "the respondent actively chose this order" from "the respondent skipped the question."

Making the question required would be meaningless because a valid answer is always present.

To support a true "required" behavior, we would need one of:

  1. A two-box drag-and-drop (unranked → ranked), as suggested in Voters can rank the options given in order of importance #1278. This would make it clear whether the respondent actively ranked items. However, it could be bulky and hard to use on mobile or with long option texts.
  2. A confirmation button that the respondent clicks to confirm they agree with the current ordering before it counts as answered.

For now, ranking questions simply always submit the current order, defaulting to the original option order if unchanged.

…ttest for blank answer

Signed-off-by: paul bochtler <65470117+datapumpernickel@users.noreply.github.com>
@datapumpernickel
Copy link
Copy Markdown
Author

datapumpernickel commented Mar 29, 2026

Ok, it is now implemented as a tap-and-drag interface, which allows to set a required-flag or leave it blank. 🎊
Sorry, for the forth-and-back.

See attached video for demonstration: https://github.com/user-attachments/assets/9745e93c-87db-49ae-990f-ed305827deee

@Chartman123
Copy link
Copy Markdown
Collaborator

Looks good :)

One thing I noticed: in submit view you can't change the order by keyboard. And for consistency we should move the drag handle to the end of the options like in create view.

…e keyboard menu

Signed-off-by: paul bochtler <65470117+datapumpernickel@users.noreply.github.com>
@datapumpernickel
Copy link
Copy Markdown
Author

Hah, good catch. I tried to be more consistent with the design now. Keyboard should work now, but I do find the whole keyboard use a little unreliable still. I think I might be out of my depth for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants