Skip to content

Conversation

@github-classroom
Copy link

@github-classroom github-classroom bot commented Oct 20, 2025

👋! GitHub Classroom created this pull request as a place for your teacher to leave feedback on your work. It will update automatically. Don’t close or merge this pull request, unless you’re instructed to do so by your teacher.
In this pull request, your teacher can leave comments and feedback on your code. Click the Subscribe button to be notified if that happens.
Click the Files changed or Commits tab to see all of the changes pushed to the default branch since the assignment started. Your teacher can see this too.

Notes for teachers

Use this PR to leave feedback. Here are some tips:

  • Click the Files changed tab to see all of the changes pushed to the default branch since the assignment started. To leave comments on specific lines of code, put your cursor over a line of code and click the blue + (plus sign). To learn more about comments, read “Commenting on a pull request”.
  • Click the Commits tab to see the commits pushed to the default branch. Click a commit to see specific changes.
  • If you turned on autograding, then click the Checks tab to see the results.
  • This page is an overview. It shows commits, line comments, and general comments. You can leave a general comment below.
    For more information about this pull request, read “Leaving assignment feedback in GitHub”.

Subscribed: @eafalkens

@github-actions
Copy link

github-actions bot commented Oct 20, 2025

🤖 AI Feedback

🕒 Posted on 2025-10-29T13:17:40.055Z

Overall Feedback

The submission shows strong understanding of OOP principles and tests pass for BasicTest. However, several critical issues in Warehouse implementation and WarehouseAnalyzer cause EdgeCaseTest failures. Fix these prioritized issues to get all tests green.

Areas for Improvement

  1. Warehouse changedProducts tracking (Line ~110)
    Issue: changedProducts isn't cleared when products are removed. When remove(UUID) is called, existing references remain, causing stale data in getChangedProducts().
    Suggestion: Add changedProducts.removeIf(p -> p.uuid().equals(id)); in remove(UUID) to ensure references match removed products.

  2. Discount Calculation Logic (Line ~334)
    Issue: Discount multiplications are inverted. 0.5*price gives 50% of original price (50% discount) not "50% discount" (which should be price*0.5). Tests expect original price multiplied by discount factors (e.g., 100 * 0.5 = 50 for today's expiry).
    Suggestion: Keep the multiplication but update test explanations to clarify:

    // Should become: 100 * 0.5 = 50 for today
    discounted = p.price().multiply(new BigDecimal("0.50")); 
  3. Weighted Average Median Calculation (Line ~211)
    Issue: calculateMedian for even-length arrays returns the average of middle elements. Tests expect the higher of the two middle values (e.g., [1,2,3,4] → 3).
    Suggestion: Return sorted[n/2] for even-length arrays:

    if (n % 2 == 0) {
        return sorted[n/2]; // Return higher middle value
    }
  4. Expiration Window Check (Line ~260)
    Issue: Missing check for items already expired. Tests include "already expired" items expected to be excluded.
    Suggestion: Add !p.isExpired() to filter expired items:

    if (p instanceof FoodProduct foodProduct && !foodProduct.isExpired()) { ... }
  5. Category Name Normalization (Line ~37)
    Issue: Fails for names starting with non-letter characters (e.g., " fruit" → " Fruit" with extra space).
    Suggestion: Trim before normalization:

    String normalized = trimmed.substring(0, 1).toUpperCase() + trimmed.substring(1).toLowerCase();

Summary

Address the changedProducts inconsistency and median calculation error first—they block test success most critically. Correct discount logic and expiration filtering before minor fixes. The solution demonstrates good design; attention to these implementation details will make it robust.


Previous Feedback

🕒 Posted on 2025-10-24T16:10:38.033Z

Overall Feedback

The implementation demonstrates a solid understanding of Java conventions, object-oriented design, and the assignment requirements. The code passes all provided tests correctly.

Areas for Improvement

The Warehouse class is missing the required getChangedProducts() method. This method should return an unmodifiable list of products modified via updateProductPrice(). Add:

public List<Product> getChangedProducts() {
    return Collections.unmodifiableList(new ArrayList<>(changedProducts));
}

Summary

Complete the implementation of getChangedProducts() in Warehouse to track changed products as specified in the assignment requirements.


Previous Feedback

🕒 Posted on 2025-10-20T17:21:23.982Z

Overall Feedback

Looks Good To Me (LGTM) – All implemented features work correctly, handle edge cases, and pass every test (including advanced requirements). Excellent work on complex logic like weighted averages, outlier detection, and shipping optimization.


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