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

InCamp Task #7

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

InCamp Task #7

wants to merge 9 commits into from

Conversation

oleksiibon
Copy link

No description provided.

Copy link
Owner

@alexanderko alexanderko left a comment

Choose a reason for hiding this comment

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

Improve code style

int getCostByCategory(Category category) {
return products.stream()
.filter(p -> p.category == category)
.mapToInt(p -> p.price)
.reduce(0, (a, b) -> a + b);
}

int getCostByOutlet(Outlet outlet) {
Copy link
Owner

Choose a reason for hiding this comment

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

Implement generic getSubCost method and pass Predicate<Product> as parameter.


@Override
public boolean checkCondition(Check check) {
if(check.getCostByCategory(category) != 0){
Copy link
Owner

Choose a reason for hiding this comment

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

configure required amount


@Override
public boolean checkCondition(Check check) {
if(check.getCostByOutlet(outlet) != 0){
Copy link
Owner

Choose a reason for hiding this comment

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

configure required amount


public Offer(LocalDate expiredDate, Reward rewardType, Condition conditionType) {
this.expiredDate = expiredDate;
this.rewardType = rewardType;
Copy link
Owner

Choose a reason for hiding this comment

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

Remove type form field names

@@ -1,6 +1,9 @@
import checkout.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import sun.security.x509.CertAttrSet;
Copy link
Owner

Choose a reason for hiding this comment

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

Remove wrong inport

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.

3 participants