Skip to content

Conversation

github-classroom[bot]
Copy link

@github-classroom github-classroom bot commented Sep 9, 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: @gitnes94

Copy link

github-actions bot commented Sep 9, 2025

What's Working Well:

  • CLI argument parsing handles all required options correctly
  • Proper error handling for invalid zones and date formats
  • Good use of the ElpriserAPI to fetch price data

Areas for Improvement:

Issue: Charging window calculation doesn't prioritize earliest hour in case of ties (Main.java:119-138)
Suggestion: When finding the minimum sum, check for ties and select the earliest start index. Add a condition to compare currentSum == minSum and choose the earlier start time.

Issue: Missing check for valid charging durations (Main.java:95-105)
Suggestion: Validate that chargingHours is exactly 2, 4, or 8, not just within 2-8 range. Add explicit validation: if (chargingHours != 2 && chargingHours != 4 && chargingHours != 8)

Issue: Incorrect output formatting for charging window (Main.java:149-150)
Suggestion: Remove the stray "Påbörja laddning" print statement that appears before the actual charging window output.

Issue: Price display uses HH:mm format for end time but HH format for start time (Main.java:182-186)
Suggestion: Use consistent time formatting throughout - either both HH:mm or both HH format for better readability.

Summary:

The core functionality works well, but the charging window algorithm needs refinement to properly handle price ties and validate acceptable durations.

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.

1 participant