Conversation
Bumps the github-actions group with 4 updates: [dorny/paths-filter](https://github.com/dorny/paths-filter), [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action), [docker/build-push-action](https://github.com/docker/build-push-action) and [docker/login-action](https://github.com/docker/login-action). Updates `dorny/paths-filter` from 3 to 4 - [Release notes](https://github.com/dorny/paths-filter/releases) - [Changelog](https://github.com/dorny/paths-filter/blob/master/CHANGELOG.md) - [Commits](dorny/paths-filter@v3...v4) Updates `docker/setup-buildx-action` from 3 to 4 - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](docker/setup-buildx-action@v3...v4) Updates `docker/build-push-action` from 6 to 7 - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](docker/build-push-action@v6...v7) Updates `docker/login-action` from 3 to 4 - [Release notes](https://github.com/docker/login-action/releases) - [Commits](docker/login-action@v3...v4) --- updated-dependencies: - dependency-name: dorny/paths-filter dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: docker/setup-buildx-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: docker/build-push-action dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: docker/login-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com>
…ions/dev/github-actions-6011ca780b chore(deps): bump the github-actions group with 4 updates
…cache - Replaced cached opening hours retrieval with a new method to fetch current opening hours from the database across multiple controllers. - Introduced a new OpeningHour model to manage opening hours data, including validations and methods for schedule management. - Updated the admin dashboard and related views to reflect changes in opening hours handling. - Added migration to persist opening hours in the database and ensure proper structure for future updates.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c39270efec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| say_with_time "Ensuring one opening hour row per weekday" do | ||
| DEFAULT_SCHEDULE.each do |day_name, value| | ||
| day_value = DAY_MAP.fetch(day_name) | ||
| record = OpeningHourRecord.find_or_initialize_by(day: day_value) |
There was a problem hiding this comment.
Preserve existing opening-hour rows during migration
When this migration runs on a database that already has opening_hours rows, find_or_initialize_by returns the existing row and the following default-assignment block overwrites its stored open_at/close_at values with DEFAULT_SCHEDULE. The preceding deduplication step keeps the latest row per day, so this migration appears intended to retain existing data and only fill missing weekdays; as written it discards any non-default schedule during deploy.
Useful? React with 👍 / 👎.
| redirect_to admin_opening_hours_path, notice: t(".success") | ||
| rescue ActiveRecord::RecordInvalid, ArgumentError => e | ||
| @opening_hours = updated_hours || current_opening_hours | ||
| @error_message = e.record&.errors&.full_messages&.to_sentence || e.message |
There was a problem hiding this comment.
Handle ArgumentError without calling record
When OpeningHour.replace_schedule! raises an ArgumentError here, for example from a crafted time parameter like open_hour_lundi=100 that produces an invalid range, this rescue path raises a new NoMethodError because ArgumentError does not respond to record. That turns the intended validation response into a 500 instead of rendering the edit form with e.message.
Useful? React with 👍 / 👎.
| change_column_null :opening_hours, :open_at, false | ||
| change_column_null :opening_hours, :close_at, false |
There was a problem hiding this comment.
Make the rollback tolerate seeded closed days
Rolling back immediately after this migration will fail because up seeds Monday as closed with open_at/close_at set to NULL, but down changes those columns back to null: false before replacing or deleting the null values. Any environment that needs to rollback after deploying this migration will hit a NOT NULL violation here.
Useful? React with 👍 / 👎.
No description provided.