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

Skip validation if asset warranty date is not changed #1502

Merged
merged 4 commits into from
Aug 8, 2023
Merged

Conversation

rithviknishad
Copy link
Member

@rithviknishad rithviknishad commented Aug 2, 2023

Proposed Changes

  • Skip validation if asset warranty date is not changed

Associated Issue

Merge Checklist

  • Tests added/fixed
  • Update docs in /docs
  • Linting Complete
  • Any other necessary step

Only PR's with test cases included and passing lint and test pipelines will be reviewed

@coronasafe/care-backend-maintainers @coronasafe/care-backend-admins

@rithviknishad
Copy link
Member Author

@rithviknishad to add test cases

Copy link
Member

@Ashesh3 Ashesh3 left a comment

Choose a reason for hiding this comment

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

This works fine. Though, would it be better quality wise if we merge this if with the latter one and only raise the Validation error in the below case? Then we'd not have to pop out data being sent by the user, since the warranty is same anyways and we just don't validate it, but it does make it a long if condition. What are your thoughts?

if self.instance
    and self.instance.warranty_amc_end_of_validity
    and self.instance.warranty_amc_end_of_validity != attrs["warranty_amc_end_of_validity"]
    and attrs.get("warranty_amc_end_of_validity")
    and attrs["warranty_amc_end_of_validity"] < datetime.now().date()
    :
        raise ValidationError(

@vigneshhari vigneshhari merged commit 8fe498e into master Aug 8, 2023
2 checks passed
@vigneshhari vigneshhari deleted the fix-1500 branch August 8, 2023 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warranty expiry in past is not allowing asset detail page to update
4 participants