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

Fix 215 #219

Merged
merged 9 commits into from
Nov 4, 2020
Merged

Fix 215 #219

merged 9 commits into from
Nov 4, 2020

Conversation

Jh123x
Copy link

@Jh123x Jh123x commented Nov 1, 2020

Closes #215

  • Update getMessageConstraint as abstract
  • Standardise Variable names
  • Move MESSAGE_INVALID_INDEX into Index instead of ParserUtil

@Jh123x Jh123x added the code quality improvements for the marks label Nov 1, 2020
@Jh123x Jh123x added this to the v1.4 milestone Nov 1, 2020
@Jh123x Jh123x self-assigned this Nov 1, 2020
@JoeyChenSmart
Copy link

I was thinking more in the line of "the two methods should point to the same string" rather than "the two different strings should have the same content", but that might take a bit of work.

Also related PR #208 not sure if theres overlaps?

@codecov-io
Copy link

codecov-io commented Nov 1, 2020

Codecov Report

Merging #219 into master will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #219      +/-   ##
============================================
+ Coverage     71.07%   71.10%   +0.03%     
- Complexity      552      554       +2     
============================================
  Files            87       87              
  Lines          1884     1886       +2     
  Branches        151      151              
============================================
+ Hits           1339     1341       +2     
  Misses          486      486              
  Partials         59       59              
Impacted Files Coverage Δ Complexity Δ
...n/java/jimmy/mcgymmy/commons/core/index/Index.java 100.00% <ø> (ø) 10.00 <0.00> (ø)
...n/java/jimmy/mcgymmy/model/food/Macronutrient.java 86.95% <ø> (-0.55%) 17.00 <0.00> (-1.00)
...in/java/jimmy/mcgymmy/logic/parser/ParserUtil.java 69.13% <100.00%> (ø) 15.00 <0.00> (ø)
...in/java/jimmy/mcgymmy/model/food/Carbohydrate.java 50.00% <100.00%> (+7.14%) 4.00 <1.00> (+1.00)
src/main/java/jimmy/mcgymmy/model/food/Fat.java 50.00% <100.00%> (+7.14%) 4.00 <1.00> (+1.00)
...rc/main/java/jimmy/mcgymmy/model/food/Protein.java 50.00% <100.00%> (+7.14%) 4.00 <2.00> (+1.00)

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 3a6fcd2...dbad0ca. Read the comment docs.

@Jh123x
Copy link
Author

Jh123x commented Nov 3, 2020

I was thinking more in the line of "the two methods should point to the same string" rather than "the two different strings should have the same content", but that might take a bit of work.

Also related PR #208 not sure if theres overlaps?

Yeap i think it overlaps x.x

Copy link

@aidoxe-123 aidoxe-123 left a comment

Choose a reason for hiding this comment

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

I think the old implementation of getMessageConstraint is better than this one. I have given more details about why I think so in one of the comments

Comment on lines -49 to -51
private String getMessageConstraint() {
return this.getMacronutrientType() + " amount can only take in value larger than 0 and less than 1000";
}

Choose a reason for hiding this comment

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

I think we should move "amount can only ..." outside to be a string called MESSAGE_CONSTRAINT_SUFFIX. The old implementation works just as fine as the new one. The old one even has fewer repeated code. So why do we need to change?

Copy link
Author

Choose a reason for hiding this comment

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

It is to make sure all of them point to the same message so that the messages shown will be consistent everywhere

Choose a reason for hiding this comment

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

The old one also makes sure all of them point to the same message, isn't it

Copy link

@aidoxe-123 aidoxe-123 left a comment

Choose a reason for hiding this comment

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

LGTM

@aidoxe-123 aidoxe-123 merged commit 650fc97 into AY2021S1-CS2103T-W17-3:master Nov 4, 2020
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.

Clean up macronutrient class
5 participants