dependency-track icon indicating copy to clipboard operation
dependency-track copied to clipboard

Add active Field To Project Versions

Open aravindparappil46 opened this issue 9 months ago • 1 comments

Description

In order for the frontend to distinguish between active or inactive project versions, we need to include the active boolean field to ProjectVersion model.

Addressed Issue

Required for https://github.com/DependencyTrack/frontend/issues/844

Checklist

  • [x] I have read and understand the contributing guidelines
  • [ ] This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • [x] This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • [ ] This PR introduces changes to the database model, and I have added corresponding update logic
  • [ ] This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

aravindparappil46 avatar May 10 '24 01:05 aravindparappil46

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
:white_check_mark: +0.02% (target: -1.00%) :white_check_mark: 100.00% (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (cf4f2d4d9b9341ada5da3691e0fe4e13bf0baf7d) 22058 16750 75.94%
Head commit (14fa2eb0d6d4cf3b12d679419f8aaddcaa54f8c1) 22045 (-13) 16745 (-5) 75.96% (+0.02%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3691) 2 2 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy will stop sending the deprecated coverage status from June 5th, 2024. Learn more

codacy-production[bot] avatar May 10 '24 01:05 codacy-production[bot]

@aravindparappil46 The coverage check is failing, primarily because the change itself is so tiny.

We can bypass it, but another solution could be to remove the set* methods from the ProjectVersion class. DataNucleus can use the constructor to instantiate the class. It seems the missing coverage here comes from the fact that the setActive method is never called.

nscuro avatar May 10 '24 10:05 nscuro

Thank you @nscuro ! I removed the setActive which I added and the coverage check is passing now. Do let me know if you'd prefer removing all of the setters (I didn't want to refactor parts I didn't touch without confirming)

aravindparappil46 avatar May 11 '24 03:05 aravindparappil46

Do let me know if you'd prefer removing all of the setters [...]

I think that would be good to avoid future confusion. You could also simply convert ProjectVersion to a record instead.

nscuro avatar May 11 '24 09:05 nscuro