Skip to content

Conversation

@DimitrijeDimitrijevic
Copy link
Contributor

Fixes sporadic issue when duplicate key is in multi.

@alxlion
Copy link
Contributor

alxlion commented Oct 24, 2025

The tests are not passing:

  1) test quizzes calculate_user_score/2 correctly calculates score (Claper.QuizzesTest)
     test/claper/quizzes_test.exs:147
     ** (FunctionClauseError) no function clause matching in Claper.Quizzes.submit_quiz/3

     The following arguments were given to Claper.Quizzes.submit_quiz/3:

         # 1
         2153

         # 2
         [%Claper.Quizzes.QuizQuestionOpt{__meta__: #Ecto.Schema.Metadata<:loaded, "quiz_question_opts">, id: 273, content: "option 1", is_correct: true, response_count: 0, percentage: nil, quiz_question_id: 137, quiz_question: #Ecto.Association.NotLoaded<association :quiz_question is not loaded>, inserted_at: ~N[2025-10-24 06:00:47], updated_at: ~N[2025-10-24 06:00:47]}]

         # 3
         137

     Attempted function clauses (showing 2 out of 2):

         def submit_quiz(%Claper.Accounts.User{} = user, quiz_opts, quiz_id)
         def submit_quiz(attendee_identifier, quiz_opts, quiz_id) when is_binary(attendee_identifier) and is_list(quiz_opts)

     code: {:ok, _} = Quizzes.submit_quiz(user.id, [correct_option], quiz.id)
     stacktrace:
       (claper 2.4.0) lib/claper/quizzes.ex:302: Claper.Quizzes.submit_quiz/3
       test/claper/quizzes_test.exs:154: (test)

..

  2) test quizzes submit_quiz/3 with user_id records responses and updates counts (Claper.QuizzesTest)
     test/claper/quizzes_test.exs:116
     ** (FunctionClauseError) no function clause matching in Claper.Quizzes.submit_quiz/3

     The following arguments were given to Claper.Quizzes.submit_quiz/3:

         # 1
         2157

         # 2
         [%Claper.Quizzes.QuizQuestionOpt{__meta__: #Ecto.Schema.Metadata<:loaded, "quiz_question_opts">, id: 279, content: "option 1", is_correct: true, response_count: 0, percentage: nil, quiz_question_id: 140, quiz_question: #Ecto.Association.NotLoaded<association :quiz_question is not loaded>, inserted_at: ~N[2025-10-24 06:00:48], updated_at: ~N[2025-10-24 06:00:48]}]

         # 3
         140

     Attempted function clauses (showing 2 out of 2):

         def submit_quiz(%Claper.Accounts.User{} = user, quiz_opts, quiz_id)
         def submit_quiz(attendee_identifier, quiz_opts, quiz_id) when is_binary(attendee_identifier) and is_list(quiz_opts)

     code: Quizzes.submit_quiz(user.id, [option], quiz.id)
     stacktrace:
       (claper 2.4.0) lib/claper/quizzes.ex:302: Claper.Quizzes.submit_quiz/3
       test/claper/quizzes_test.exs:123: (test)

@DimitrijeDimitrijevic
Copy link
Contributor Author

DimitrijeDimitrijevic commented Oct 24, 2025 via email

@DimitrijeDimitrijevic
Copy link
Contributor Author

DimitrijeDimitrijevic commented Oct 24, 2025

Updated tests, so they match how things work now.

@alxlion alxlion changed the title Bugfix quiz Fix duplicate key quiz when duplicate Nov 4, 2025
@alxlion alxlion merged commit 16bcce1 into ClaperCo:dev Nov 4, 2025
1 check passed
alxlion added a commit that referenced this pull request Dec 26, 2025
## ⚠️ Breaking changes

- S3 variables are now named: S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, S3_REGION and S3_BUCKET
- Users now have roles. Refer to the `roles` table and assign a role to a user with the `role_id` column in the `users` table.

## Features

- Add Admin Panel to manage users and presentations
- Add user roles: user, admin
- Add `LANGUAGES` setting to configure available languages in the app
- Add hideable presenter attendee count (#183 #155)
- Add Hungarian translation (#161)
- Add Latvian translation (#163)
- Add custom S3 endpoint with `S3_SCHEME`, `S3_HOST`, `S3_PORT` and `S3_PUBLIC_URL`

## Fixes and improvements

- Upgrade JS dependencies
- Upgrade Elixir dependencies, including Phoenix Live View to 1.0.17
- Upgrade to Tailwind 4+
- Refactor view templates to use {} instead of <%= %>
- Fix event name validation to be required
- Docker image is now using Ubuntu instead of Alpine for better dependencies support
- Fix scrollbar not showing in event manager when no presentation file (#164) (@aryel780)
- Fix settings scroll for small screen (#168)
- Fix duplicate key quiz when duplicate (#182)
- Fix email change confirmation (#172)
- Fix italian translation (#179)
- Fix random poll choices (#184)
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