Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joined at date can't be in future #1751

Merged
merged 5 commits into from
Mar 26, 2024
Merged

Conversation

apoorv1316
Copy link
Contributor

Closes #1739

@apoorv1316 apoorv1316 requested a review from nisusam March 22, 2024 04:54
app/models/employment.rb Outdated Show resolved Hide resolved
@@ -38,7 +38,7 @@ class Employment < ApplicationRecord
# Validations
validates :designation, :employment_type, :joined_at, :employee_id, presence: true, on: :update
validates :resigned_at, comparison: { greater_than: :joined_at }, unless: -> { resigned_at.nil? }

validates :joined_at, comparison: { less_than_or_equal_to: Date.today, message: "date must be in past" }, on: :update
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove on: :update

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is needed, otherwise it will be triggered when inviting new user to company

@apoorv1316 apoorv1316 merged commit 974c1b8 into develop Mar 26, 2024
1 check passed
@apoorv1316 apoorv1316 deleted the joined-at-date-validation branch March 26, 2024 14:27
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.

Future date of joining should not be selected for a team member
3 participants