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

5857 – apply_replace_by should save history version and not error if the old_pm does not exist #2163

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

vasconsaurus
Copy link
Contributor

Description

When we run apply_replace_by, we look for the original project media id, but sometimes that doesn't exist anymore.

This only causes an error when we try to save that information to the history versioning. Since we already have access to that original project media id, we can just grab that value and save that information.

References: 5857

How has this been tested?

test "should save history version even if the original project media does not exist anymore": rails test test/models/project_media_5_test.rb:888

Things to pay attention to during code review

Please describe parts of the change that require extra attention during code review, for example:

  • File FFFF, line LL: This refactoring does this and this. Is it consistent with how it’s implemented elsewhere?
  • Etc.

Checklist

  • I have performed a self-review of my own code
  • I have added unit and feature tests, if the PR implements a new feature or otherwise would benefit from additional testing
  • I have added regression tests, if the PR fixes a bug
  • I have added logging, exception reporting, and custom tracing with any additional information required for debugging
  • I considered secure coding practices when writing this code. Any security concerns are noted above.
  • I have commented my code in hard-to-understand areas, if any
  • I have made needed changes to the README
  • My changes generate no new warnings
  • If I added a third party module, I included a rationale for doing so and followed our current guidelines

Sometimes by the time we get to the line where we try to access old_pm.id,
old_pm does not exist anymore.

Because that line is just for auditing, versioning, we can just
add old_pm_id (since we have access to that information)
@vasconsaurus vasconsaurus marked this pull request as ready for review December 19, 2024 19:54
Copy link

codeclimate bot commented Dec 19, 2024

Code Climate has analyzed commit 817c080 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (100% is the threshold).

This pull request will bring the total coverage in the repository to 100.0% (0.0% change).

View more on Code Climate.

Copy link
Contributor

@caiosba caiosba left a comment

Choose a reason for hiding this comment

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

🚢

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