Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

added percentage strategy #726

Merged
merged 82 commits into from
Mar 17, 2021
Merged

added percentage strategy #726

merged 82 commits into from
Mar 17, 2021

Conversation

lucassaleszup
Copy link
Contributor

Signed-off-by: Lucas Sales lucas.sales@zup.com.br

Signed-off-by: Lucas Sales <lucas.sales@zup.com.br>
@boring-cyborg boring-cyborg bot added circle-matcher Improvements/additions/fixes for circle-matcher module. moove Improvements/additions/fixes for moove module. labels Dec 1, 2020
@codecov
Copy link

codecov bot commented Dec 1, 2020

Codecov Report

Merging #726 (327ae96) into main (320e997) will increase coverage by 0.40%.
The diff coverage is 85.26%.

❗ Current head 327ae96 differs from pull request most recent head 467323f. Consider uploading reports for the commit 467323f to get more accurate results
Impacted file tree graph

@@             Coverage Diff              @@
##               main     #726      +/-   ##
============================================
+ Coverage     77.48%   77.88%   +0.40%     
- Complexity     1978     2064      +86     
============================================
  Files          1192     1209      +17     
  Lines         16408    16854     +446     
  Branches       1493     1566      +73     
============================================
+ Hits          12713    13126     +413     
- Misses         3229     3237       +8     
- Partials        466      491      +25     
Flag Coverage Δ Complexity Δ
circlematcher 87.31% <81.81%> (-0.70%) 0.00 <44.00> (ø)
moove 74.41% <90.16%> (+0.34%) 0.00 <46.00> (ø)
ui 80.99% <84.40%> (+0.53%) 0.00 <0.00> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...matcher/api/request/CreateSegmentationRequest.java 100.00% <ø> (ø) 1.00 <0.00> (ø)
...matcher/api/request/UpdateSegmentationRequest.java 100.00% <ø> (ø) 3.00 <0.00> (ø)
.../application/circle/request/CreateCircleRequest.kt 91.30% <ø> (ø) 2.00 <0.00> (ø)
ui/src/core/assets/themes/index.ts 100.00% <ø> (ø) 0.00 <0.00> (ø)
ui/src/core/components/Button/Rounded/index.tsx 100.00% <ø> (ø) 0.00 <0.00> (ø)
ui/src/core/components/Form/Input/index.tsx 100.00% <ø> (ø) 0.00 <0.00> (ø)
ui/src/core/components/Popover/index.tsx 100.00% <ø> (ø) 0.00 <0.00> (ø)
ui/src/modules/Circles/Release/Create/index.tsx 66.66% <ø> (ø) 0.00 <0.00> (ø)
ui/src/modules/Circles/Comparation/Item/index.tsx 53.22% <26.31%> (-5.27%) 0.00 <0.00> (ø)
ui/src/modules/Circles/Release/hooks.ts 79.06% <57.14%> (-11.26%) 0.00 <0.00> (ø)
... and 73 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 320e997...467323f. Read the comment docs.

Signed-off-by: Lucas Sales <lucas.sales@zup.com.br>
ui/src/core/assets/svg/alternate-down.svg Outdated Show resolved Hide resolved
ui/src/core/assets/svg/alternate-down.svg Outdated Show resolved Hide resolved
ui/src/core/assets/svg/manually.svg Outdated Show resolved Hide resolved
ui/src/core/assets/svg/percentage.svg Outdated Show resolved Hide resolved
ui/src/core/assets/svg/percentage.svg Outdated Show resolved Hide resolved
Signed-off-by: Lucas Sales <lucas.sales@zup.com.br>
<g id="Group-16" transform="translate(1098.000000, 0.000000)">
<g id="Icon/Arrow/Straight/Left-Copy-3" transform="translate(75.000000, 312.000000)">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
Copy link
Contributor

Choose a reason for hiding this comment

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

change path-1 to path-alert.

<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="Icon-Alert-Triangle" fill="#FFD60A" xlink:href="#path-1"></use>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<use id="Icon-Alert-Triangle" fill="#FFD60A" xlink:href="#path-1"></use>
<use id="Icon-Alert-Triangle" fill="currentColor" xlink:href="#path-1"></use>

<mask id="mask-2-alternate-down" fill="white">
<use xlink:href="#path-1-alternate-down"></use>
</mask>
<use id="Icon-Chevron-Down" fill="#B9B9BE" xlink:href="#path-1-alternate-down"></use>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<use id="Icon-Chevron-Down" fill="#B9B9BE" xlink:href="#path-1-alternate-down"></use>
<use id="Icon-Chevron-Down" fill="currentColor" xlink:href="#path-1-alternate-down"></use>

<mask id="mask-2-manually" fill="white">
<use xlink:href="#path-1-manually"></use>
</mask>
<use id="Icon-Edit" fill="#B9B9BE" xlink:href="#path-1-manually"></use>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<use id="Icon-Edit" fill="#B9B9BE" xlink:href="#path-1-manually"></use>
<use id="Icon-Edit" fill="currentColor" xlink:href="#path-1-manually"></use>

<mask id="mask-2-percentage" fill="white">
<use xlink:href="#path-1-percentage"></use>
</mask>
<use id="Icon-Percent" fill="#B9B9BE" xlink:href="#path-1-percentage"></use>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<use id="Icon-Percent" fill="#B9B9BE" xlink:href="#path-1-percentage"></use>
<use id="Icon-Percent" fill="currentColor" xlink:href="#path-1-percentage"></use>

<mask id="mask-2-up" fill="white">
<use xlink:href="#path-1-up"></use>
</mask>
<use id="Icon-Chevron-Up" fill="#B9B9BE" transform="translate(4.666833, 2.666750) scale(1, -1) translate(-4.666833, -2.666750) " xlink:href="#path-1-up"></use>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<use id="Icon-Chevron-Up" fill="#B9B9BE" transform="translate(4.666833, 2.666750) scale(1, -1) translate(-4.666833, -2.666750) " xlink:href="#path-1-up"></use>
<use id="Icon-Chevron-Up" fill="currentColor" transform="translate(4.666833, 2.666750) scale(1, -1) translate(-4.666833, -2.666750) " xlink:href="#path-1-up"></use>

placeholder="Value"
ref={register({
required: 'Percentage is required.',
validate: value => {
Copy link
Contributor

Choose a reason for hiding this comment

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

what do you think of putting this in utils?

Signed-off-by: Lucas Sales <lucas.sales@zup.com.br>
Leandroqo
Leandroqo previously approved these changes Dec 2, 2020
Signed-off-by: Thalles Freitas <thalles.freitas@zup.com.br>
thallesfreitaszup and others added 2 commits December 8, 2020 09:15
Signed-off-by: Lucas Sales <lucas.sales@zup.com.br>
@boring-cyborg boring-cyborg bot added the butler Improvements/additions/fixes for butler module. label Dec 15, 2020
bCatanant
bCatanant previously approved these changes Dec 15, 2020
Signed-off-by: thalles freitas <thalles.freitas@zup.com.br>
Signed-off-by: thalles freitas <thalles.freitas@zup.com.br>
Signed-off-by: thalles freitas <thalles.freitas@zup.com.br>
Signed-off-by: Lucas Sales <lucas.sales@zup.com.br>
ifdouglas
ifdouglas previously approved these changes Jan 5, 2021
Signed-off-by: thalles freitas <thalles.freitas@zup.com.br>
 into percentage-strategy

Signed-off-by: thalles freitas <thalles.freitas@zup.com.br>
@@ -36,6 +36,13 @@ public String getName() {
return name;
}

public static Circle from(KeyMetadata keyMetadata) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Verify if argument is null/invalid and throw IllegalArgumentException if so, or it may cause a NPE.

Copy link
Contributor

Choose a reason for hiding this comment

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

This validation is done here with the ifPresent, it is necessary to do inside the class?

this.getCircleByPercentage(percentageMatched)
.ifPresent(keyMetadata -> matched.add(Circle.from(keyMetadata)));

Copy link
Contributor

Choose a reason for hiding this comment

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

The use of method is ok (null safe), but it's a good practice to avoid this kind of risk encapsulating this validation, because you cannot guarantee that everyone that will use this method has this concern.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed.Done

return this.percentage;
}

public void setPercentage(Integer percentage) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This must not allow values lower than 0 and bigger than 100. This should be verified here and also throw IllegalArgumentException if so.

Copy link
Contributor

Choose a reason for hiding this comment

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

the validation was inserted on the request dto entity, it is necessary to add here too? also the percentage could be null on csv and regular circles.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it guaranteed that the use of this attribute will only be by request dto? If yes, ok. If not, the verification is a good practice (in case of not null).

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not.Done

this.percentage = percentage;
}

public int sumPercentage(Integer percentageToSum) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The result of sum should also be verified before change the variable. Not < 0 and not > 100.

Copy link
Contributor

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@emiteze emiteze left a comment

Choose a reason for hiding this comment

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

Please check my comments, i approved instead of asking for changes

ifdouglas and others added 3 commits March 12, 2021 09:32
Signed-off-by: thalles freitas <thalles.freitas@zup.com.br>
Signed-off-by: thalles freitas <thalles.freitas@zup.com.br>
 into percentage-strategy

Signed-off-by: thalles freitas <thalles.freitas@zup.com.br>
Signed-off-by: thalles freitas <thalles.freitas@zup.com.br>
bCatanant
bCatanant previously approved these changes Mar 16, 2021
eliasalveszup
eliasalveszup previously approved these changes Mar 16, 2021
emiteze
emiteze previously approved these changes Mar 16, 2021
Signed-off-by: thalles freitas <thalles.freitas@zup.com.br>
@angelicalimazup angelicalimazup self-requested a review March 16, 2021 20:41
@angelicalimazup angelicalimazup merged commit ca12571 into main Mar 17, 2021
@angelicalimazup angelicalimazup deleted the percentage-strategy branch March 17, 2021 11:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
butler Improvements/additions/fixes for butler module. circle-matcher Improvements/additions/fixes for circle-matcher module. moove Improvements/additions/fixes for moove module. TESTED QA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants