Skip to content

Sheffield | May-2025 | Declan Williams | Sprint-3 #623

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

Open
wants to merge 42 commits into
base: main
Choose a base branch
from

Conversation

CatchingKiyoko
Copy link

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

  1. Implemented changes and fixes to files.
  2. added comments detailing ,explaining code and answered questions with comments.
  3. refactored some lines to make neater and easier to read.
  4. added tests with jest.

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

…CardValue function with comments explaining function and updated tests
@CatchingKiyoko CatchingKiyoko added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Participant to add when requesting review labels Jun 28, 2025
Comment on lines +4 to 12
if (angle < 90)
return "Acute angle";
if ((angle > 90) && (angle < 180))
return "Obtuse angle";
if (angle === 180)
return "Straight angle";
if ((angle > 180) && (angle < 360))
return "Reflex angle";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Your function can return undefined for some values of angle. To ensure reliability, please update the function so it always returns a defined value (which can be "Invalid angle") or throws an error. Functions that are expected to return a result should never return undefined.

Note: the spec fails to mention angles <= 0 are not "Acute angle".

Copy link
Author

Choose a reason for hiding this comment

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

addressed the problem about returning undefined for some angle values and to handle invalid inputs explicitly, I’ve added this validation check to return Invalid angle in these cases

Copy link
Contributor

Choose a reason for hiding this comment

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

In mathematics, -4/7 == 4/-7, and -4/-7 == 4/7.
So, ideally isProperFraction() should recognise all of them as proper fractions.

Similarly, -5/2 == 5/-2, and -5/-2 == 5/2.
So isProperFraction(-5, 2) should also return false because -5/2 is not a proper fraction. (Currently your function return true)

Hint: we can compare the absolute value of both parameters instead.

Copy link
Author

Choose a reason for hiding this comment

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

fixed the logic to handle division by zero and simplify return statement to correct the issues

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Jul 3, 2025
@CatchingKiyoko CatchingKiyoko added Needs Review Participant to add when requesting review and removed Reviewed Volunteer to add when completing a review labels Jul 18, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Changes look good! Well done.

Comment on lines +2 to +3
if (denominator === 0) return false; // avoid division by zero
return Math.abs(numerator) < Math.abs(denominator);
Copy link
Contributor

Choose a reason for hiding this comment

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

The condition at line 3 could also take case of cases where denominator is 0.

@@ -1,4 +1,6 @@
function getAngleType(angle) {
if (typeof angle !== "number" || angle <= 0 || angle > 360) return "Invalid angle";
Copy link
Contributor

Choose a reason for hiding this comment

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

This is good.
Since NaN is also of type "number", you could also consider rejecting NaN.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and review comments have been addressed and removed Needs Review Participant to add when requesting review labels Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Volunteer to add when work is complete and review comments have been addressed 📅 Sprint 3 Assigned during Sprint 3 of this module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

02 Complete Sprint 3 coursework
2 participants