Skip to content

Add sliders as their own interaction - #244

Open
junkerderprovinz wants to merge 1 commit into
ClaperCo:devfrom
junkerderprovinz:feature/slider-poll
Open

junkerderprovinz wants to merge 1 commit into
ClaperCo:devfrom
junkerderprovinz:feature/slider-poll

Conversation

@junkerderprovinz

@junkerderprovinz junkerderprovinz commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Reworks this PR following your review: the slider is no longer a poll type but its own interaction, Claper.Scales.Scale with Claper.Scales.ScaleResponse, labelled "Slider" in the UI.

Data model

  • scales: title, min_value, max_value, step, min_label, max_label, enabled, show_results, position, presentation_file_id.
  • scale_responses: scale_id, value, user_id or attendee_identifier, timestamps.
  • Integer values only. The changeset and check constraints enforce min_value < max_value and step > 0. A response must lie within the range and on a step, and must have exactly one of user_id or attendee_identifier. Partial unique indexes allow one response per respondent and scale.
  • The step has to reach the maximum exactly, and a slider has at most 101 points so the distribution stays readable.
  • Only raw responses are stored. Count, average, median and distribution are computed from them.

Editing after responses

Once a slider has a response, min, max and step can no longer be changed. Title, labels and "show results" can. Changing the range would change what the stored values mean, so the edit is refused with a validation error and the editor shows those fields as locked. The check runs under a row lock against the stored slider, so a response sent at the same moment cannot slip past it.

Integration

  • PresentationFile association, Claper.Interactions (count, list, move, enable, disable) and slide reordering.
  • Event import and duplication copy sliders without their responses.
  • Manage: routes, create/edit form, interaction list and menus, activation handlers, and a live results preview. The projected results follow the existing "Show results on presentation" toggle.
  • Attendees: the slider starts on the middle point. After answering they see their value and, if allowed, the results.
  • Presenter: average, median, count and a histogram, updated over PubSub on every response, including the preview inside the manage page.
  • Report: a Sliders tab with the results and a CSV export (one row per response, numeric value). Slider responses count towards the engagement rate together with poll votes, as your list asks. Reports of existing events don't change, since they have no sliders.
  • New strings are translated for de, es, fr, hu, it, lv, nl and sv. mix gettext.extract also refreshes the #: references, which is why the catalogue diff is large.

Every handler looks the slider up for the current event. Responses are accepted only for an enabled slider of the event and validated against the stored range, whatever the client sends.

Tests cover the changeset rules, one response per user and per attendee, the handler guards (disabled slider, slider of another event, out-of-range and off-step values), the aggregates including the empty case, CSV export, import and duplication without responses, the range lock, and presenter updates.

This is built the same way as #254 and touches the same files, so whichever goes in second I'll rebase.

@junkerderprovinz
junkerderprovinz force-pushed the feature/slider-poll branch 2 times, most recently from 60f086b to 0bab60d Compare September 10, 2026 18:27
@alxlion

alxlion commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Ok so for the Slide type this is more information about it, you can adapt the PR:

A numeric scale has different semantics:

  • Configurable minimum, maximum, and step
  • One numeric response rather than selected options
  • Range validation
  • Average/median/distribution rather than only option percentages
  • Numeric CSV output
  • Different rules when editing the range after responses exist

Naming

Use:

  • Domain: Claper.Scales.Scale
  • Response: Claper.Scales.ScaleResponse
  • Product/UI label: “Slider”

“Slider” describes the input control, not the collected information. A future stars, buttons, or emoji
renderer could still collect a ScaleResponse. The repository also already uses “slider” for the presentation carousel in presenter.html.heex, so Scale avoids conceptual collisions.

Suggested model

scales
| title
| min_value
| max_value
| step
| min_label
| max_label
| enabled
| show_results
| position
| presentation_file_id

scale_responses
| scale_id
| value
| user_id | attendee_identifier
| inserted_at

Start with integer values. Enforce:

  • min_value < max_value
  • step > 0
  • min_value <= value <= max_value
  • rem(value - min_value, step) == 0
  • Exactly one of user_id or attendee_identifier
  • At most one response per respondent and scale, enforced by partial unique indexes

Store raw responses as the source of truth. Calculate response count, average, and distribution from them.

Avoid denormalized counters initially.

Integration surface

A separate interaction matches the repository’s current architecture, but must be wired through every
lifecycle path:

  1. PresentationFile association
  2. Claper.Interactions counting, listing, moving, enabling, and disabling
  3. Claper.Presentations slide-reordering schema list
  4. Event import and duplication, excluding responses
  5. Manage routes, creation form, interaction list, activation handlers
  6. Attendee rendering and current-response loading
  7. Presenter aggregate rendering and PubSub updates
  8. Statistics, engagement calculations, and CSV export
  9. Gettext extraction and relevant tests

@junkerderprovinz junkerderprovinz changed the title feat: slider poll type Add sliders as their own interaction Sep 29, 2026
@junkerderprovinz

Copy link
Copy Markdown
Contributor Author

@alxlion thanks for the detailed notes. I rebuilt it along them: the slider is its own interaction now, Claper.Scales.Scale with ScaleResponse, and only the raw responses are stored. Once a slider has responses, min, max and step are locked, while title and labels can still change. The description says how each of your nine points is covered.

@junkerderprovinz
junkerderprovinz force-pushed the feature/slider-poll branch 2 times, most recently from c16188c to ddb7158 Compare October 2, 2026 01:18
@alxlion alxlion added the enhancement New feature or request label Oct 13, 2026
Attendees answer on a numeric scale with a configurable minimum, maximum
and step, and optional labels for both ends. Each attendee answers once,
enforced by partial unique indexes, and the value is checked against the
stored scale. Count, average, median and distribution are computed from
the stored responses and shown to the presenter, on the projected screen,
in the report and, if allowed, to attendees who answered. Responses
export as CSV with numeric values. Once a slider has answers its range
can no longer be changed.

This branch has not been deployed

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants