Repository navigation
feat(results): average, median, range and promoter score for scale questions - #3635
global-prog wants to merge 11 commits into
Conversation
4f0ebc9 to
6eedc91
Compare
|
@global-prog Thanks for your contribution. As said in the other PR: please create an issue/feature request before starting implentation to discuss it. Also please add screenshots to the description with before/after. This should also be added to the new rating quetions in #3637. Also please add the AI declaration to your description if you used AI for this. |
|
Thanks, noted on opening an issue first. I'll add before/after screenshots to the description. The AI declaration is added there as well. |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
…or scale questions Scale questions currently show only a bar per value, which makes it hard to compare two questions or two runs of the same form at a glance. This adds count, average, median, lowest and highest above the existing bars. The median is shown next to the average deliberately: at the response counts most forms see, a single extreme answer moves an average a long way. A 0-10 scale additionally reports a Net Promoter Score with its promoter and detractor shares, using the usual 9-10 / 7-8 / 0-6 split, since that is the shape those scales are almost always used for. Purely additive and presentational: no API change, no schema change, and questions of other types are unaffected. Signed-off-by: global-prog <raqeeb@uosamarra.edu.iq>
99fc214 to
f698725
Compare
a9c5a26 to
b1f0b88
Compare
"Net Promoter" and "NPS" are registered trademarks of Bain & Company, NICE Systems and Fred Reichheld. The summary only needs to say what the number is, so the label describes the calculation instead of using the trademarked name, and the variables behind it are named after the promoter score as well. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The figures block took over the head of the v-if chain that renders the per-value bars. A linear scale with answers lost its bars, and a ranking question showed a plain option list under its Borda ranking. Placing the figures before that chain restores both. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
b1f0b88 to
01b75fc
Compare
01b75fc to
9663412
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| (props.extraSettings as LinearScaleExtraSettings | undefined) ?? {} | ||
| ) | ||
| }) | ||
| const unsavedExtraSettings = ref<LinearScaleExtraSettings>({}) |
There was a problem hiding this comment.
Nit (optional): unsavedExtraSettings is a second copy of the pending changes that useQuestion already keeps in pendingExtraSettings, and the two are cleared by different events (the props object being replaced, the debounce firing). With the current parents they cannot diverge, so this is no bug today. It only fixes the 400 ms lag for linear scale, though: QuestionFile, QuestionMultiple and the others still read props that trail their pending changes, and on main that already loses data in QuestionFile (ticking two file types within 400 ms on a new question saves only the second).
A follow-up could make the pending changes a ref in useQuestion and expose the merged settings under a name other than extraSettings, because a setup binding with that name would silently shadow the prop in the templates of QuestionMultiple, QuestionDropdown and QuestionRanking, and then switch every question type to it. That is wider than this PR, so I would keep the overlay here.
Assisted by ClaudeCode:claude-opus-5-5
|
Nit (optional), about the first commit (f698725): its author and sign-off use the handle Assisted by ClaudeCode:claude-opus-5-5 |
Subtracting the rounded promoter and detractor percentages can be one point off, e.g. 4 promoters and 2 detractors out of 7 showed 28 instead of 29. The unused passives share and response count are dropped. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
9663412 to
cea6081
Compare
A 0-10 scale is not always a "how likely are you to recommend" question, so the promoter score now needs the new showPromoterScore extra setting. It can be switched on in the editor for a 0-10 scale only and then locks the range; the server rejects the setting on any other range. Switching it on leaves the range alone, so answers given on another scale are never scored as if they were on 0-10, and switching it off undoes it. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Server CSS gives every dt a fixed, unwrapped, end-aligned width, so the figure labels overlapped their values. The figures reset that layout, and the promoter and detractor shares get their own dd, so screen readers no longer read the score and the first share as one number. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Average, median and the promoter score were shown as raw numbers, with a decimal point in every language and a misplaced minus sign in right-to-left languages. The average is also rounded without the float error that turned an exact half into a lower value. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The figures only count given answers, while the bars below also count the submissions that skipped the question, so the same answers showed different percentages without saying why. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
"Minimum" and "Maximum" name the figures without reading like the scale's own bounds, the docblocks describe what the values contain, and a fallback for submissions without answers is dropped because the answers are always present. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
End-to-end cases for the figures above the bars, the promoter score shown only when switched on, the editor offering it only on a 0-10 scale, and the range locking as soon as it is switched on, before the debounced save. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The figures walked every answer of every submission a second time for each linear scale question, through Vue's reactive proxies, which took as long as building the bars themselves. The bars already count the answers per value, so the figures are now taken from those counts. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
cea6081 to
02f312f
Compare
Summary
Scale questions currently show a bar per value, which makes it hard to compare two questions, or two runs of the same form, at a glance.
This adds a small set of figures above the existing bars for
linearscalequestions:The median sits next to the average deliberately — at the response counts most forms see, one extreme answer moves an average a long way, and showing both makes that visible.
The promoter score is labelled by its calculation rather than as "Net Promoter Score", because "Net Promoter" and "NPS" are registered trademarks of Bain & Company, NICE Systems and Fred Reichheld.
Scope
showPromoterScoreextra setting on linear scale questions, switched on in the question's menu ("Promoter score (0 to 10 scale)"). It can be switched on for a 0–10 scale only, which then locks the range, and switching it never changes the range itself; the server rejects the setting on any other range. Existing questions don't have the setting, so they never show a promoter score until it is switched onopenapi.jsonanddocs/DataStructure.mdlist the new setting; no schema change, no migrationTesting
npm run lint,npm run stylelintand the build are clean;vue-tscshows no new errorsshowPromoterScorevalidation; Playwright specplaywright/e2e/results-scale-figures.spec.ts🤖 AI (if applicable)