Skip to content

Conversation

@tomaszhanaj
Copy link
Contributor

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation
  • Other... Please describe:

What is the current behaviour? (You can also link to an open issue here)

What is the new behaviour?
https://hyland.atlassian.net/browse/AAE-37713

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

}
}

amountWidgetOnBlur() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add return type to all methods

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated


setInitialValues(): void {
if (this.enableDisplayBasedOnLocale) {
this.decimalProperty = this.field.enableFractions ? '1.2-2' : '1.0-0';
Copy link
Contributor

@BSekula BSekula Oct 28, 2025

Choose a reason for hiding this comment

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

can we somehow make this values 1.2-2', 1.0-0 more understandable?

You can check magic number pattern e.g. https://refactoring.guru/replace-magic-number-with-symbolic-constant

A magic number is a numeric value that’s encountered in the source but has no obvious meaning. This “anti-pattern” makes it harder to understand the program and refactor the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

locale: string;
showReadonlyPlaceholder: boolean;
valueAsNumber: number;
valueAsString: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need both 🤔 valueAsNumber and valueAsString

Copy link
Contributor

@BSekula BSekula Oct 28, 2025

Choose a reason for hiding this comment

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

We are only using it here, I do not think we need this additional prop 🤔
this.amountWidgetValue = this.valueAsString;

If the valueAsNumber is only set here this.valueAsNumber = this.field.value;

This is also not needed IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

valueAsNumber is needed. it is used in amountWidgetOnFocus() when user enters the field its value is assigned to field. It is set on amountWidgetOnBlur() when user leaves the field it is used to store numeric value and when setting initial values (so it is set in two places). Its intention is to store value from field as number to not convert it from string. But valueAsString can be removed. updated.

Copy link
Contributor

@BSekula BSekula left a comment

Choose a reason for hiding this comment

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

Please check comments especially usage of valueAsNumber and valueAsString as these looks redundant

@tomaszhanaj tomaszhanaj changed the title Feature/aae 37713 amount locale display AAE-37713 amount locale display Oct 28, 2025
@tomaszhanaj tomaszhanaj changed the title AAE-37713 amount locale display AAE-37713 Amount locale display Oct 28, 2025
@tomaszhanaj tomaszhanaj force-pushed the feature/AAE-37713-amount-locale-display branch from fb8c03d to b934da6 Compare October 28, 2025 13:11
@sonarqubecloud
Copy link

@tomaszhanaj tomaszhanaj merged commit 59b148e into develop Oct 28, 2025
18 checks passed
@tomaszhanaj tomaszhanaj deleted the feature/AAE-37713-amount-locale-display branch October 28, 2025 13:41
tomaszhanaj added a commit that referenced this pull request Oct 29, 2025
tomaszhanaj added a commit that referenced this pull request Oct 29, 2025
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