Skip to content

Conversation

@horcsinbalint
Copy link
Member

No description provided.

@horcsinbalint horcsinbalint requested a review from a team as a code owner January 2, 2026 17:01
deepsource-autofix bot added a commit that referenced this pull request Jan 2, 2026
This commit fixes the style issues introduced in 9e83daf according to the output
from PHP CS Fixer.

Details: #779
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 2, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Controllers now propagate explicit question open/close timestamps from the semester's periodic event into question creation; the UI toggles voting-related inputs based on the selected question type.

Changes

Cohort / File(s) Summary
Question Creation Controllers
app/Http/Controllers/StudentsCouncil/AnonymousQuestionController.php, app/Http/Controllers/StudentsCouncil/QuestionController.php
AnonymousQuestionController::store now fetches the semester's periodic event and passes its start_date/end_date into createQuestion. QuestionController::createQuestion signature adds optional $opened_at and $closed_at; validation for max_options, options, and options.* switched to conditional Rule::requiredIf / Rule::excludeIf.
Question Type UI Interaction
resources/views/utils/question_card.blade.php
question_type select gets onchange="toggleQuestionType()"; voting options Livewire block wrapped in <div id="voting_options">. New toggleQuestionType() script enables/disables voting inputs and syncs #max_options; invoked on DOMContentLoaded.

Sequence Diagram(s)

(omitted — changes are focused and do not introduce a new multi-component control flow requiring visualization)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • kamillacziraki

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided by the author; the description is entirely empty. Complete the pull request description following the repository template, including sections for Description, Related Issue, Changes, and any Additional Notes relevant to the modifications.
Title check ❓ Inconclusive The title 'Small fixes for questions' is vague and non-descriptive, using generic phrasing that does not clearly convey the specific changes made. Revise the title to specifically describe the main changes, such as 'Add conditional validation for question options based on question type' or 'Implement dynamic question type handling with validation rules'.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2febc73 and 8a01514.

📒 Files selected for processing (2)
  • app/Http/Controllers/StudentsCouncil/QuestionController.php
  • resources/views/utils/question_card.blade.php

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 37cfeb2 and cd379f8.

📒 Files selected for processing (3)
  • app/Http/Controllers/StudentsCouncil/AnonymousQuestionController.php
  • app/Http/Controllers/StudentsCouncil/QuestionController.php
  • resources/views/utils/question_card.blade.php
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: horcsinbalint
Repo: EotvosCollegium/mars PR: 743
File: app/Http/Controllers/Auth/AdmissionController.php:237-237
Timestamp: 2025-07-08T22:59:53.901Z
Learning: When horcsinbalint defers issues for "human reviewers to check later," he's making a conscious decision to prioritize the current PR over fixing secondary issues, and this should be acknowledged rather than being insistent about immediate fixes.
📚 Learning: 2024-06-13T19:25:19.821Z
Learnt from: viktorcsimma
Repo: EotvosCollegium/mars PR: 542
File: app/Http/Controllers/Secretariat/SemesterEvaluationController.php:161-161
Timestamp: 2024-06-13T19:25:19.821Z
Learning: 'anonymous_questions' is a section name in the 'secretariat.evaluation-form.app' view and does not require handling in the `store` method of `SemesterEvaluationController.php`.

Applied to files:

  • app/Http/Controllers/StudentsCouncil/AnonymousQuestionController.php
🧬 Code graph analysis (1)
app/Http/Controllers/StudentsCouncil/AnonymousQuestionController.php (2)
app/Utils/HasPeriodicEvent.php (2)
  • periodicEventForSemester (54-62)
  • semester (180-183)
app/Http/Controllers/StudentsCouncil/QuestionController.php (1)
  • createQuestion (28-72)
🔇 Additional comments (7)
resources/views/utils/question_card.blade.php (3)

12-12: Excellent addition of the onchange handler.

The dynamic behaviour will provide immediate feedback to the user when they select different question types.


38-38: Proper initialisation on page load.

Invoking the function on DOMContentLoaded ensures the form displays in the correct state when loaded with pre-existing values.


27-36: No action required—the string literals precisely match the backend constants.

The function correctly uses "selection" and "ranking", which correspond exactly to Question::SELECTION = 'selection' and Question::RANKING = 'ranking' in the Question model. The front-end and back-end validation logic are consistent.

app/Http/Controllers/StudentsCouncil/QuestionController.php (3)

28-28: Well-structured method signature enhancement.

The addition of the optional timing parameters provides the flexibility to set explicit time windows for questions whilst maintaining backwards compatibility with existing callers.


38-40: Appropriate conditional validation logic.

The use of Rule::requiredIf and Rule::excludeIf properly enforces that voting options are only required and validated for selection or ranking question types, aligning nicely with the front-end behaviour.


60-61: The schema properly supports these timing columns.

The questions table includes both opened_at and closed_at columns defined as nullable datetime fields (migration 2023_01_18_201909_create_voting_tables.php, lines 27–28). The code assignment is sound and will function correctly without runtime errors.

app/Http/Controllers/StudentsCouncil/AnonymousQuestionController.php (1)

73-75: Excellent integration of the periodic event timing.

The implementation properly retrieves the evaluation period's timing window and gracefully handles the case where no periodic event exists using the null-safe operator. The question will inherit the correct opened and closed dates from the semester's evaluation schedule.

deepsource-autofix bot added a commit that referenced this pull request Jan 2, 2026
This commit fixes the style issues introduced in 957b147 according to the output
from PHP CS Fixer.

Details: #779
@horcsinbalint horcsinbalint merged commit 4c90683 into development Jan 2, 2026
3 of 5 checks passed
@horcsinbalint horcsinbalint deleted the question-fix branch January 2, 2026 18:36
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.

3 participants