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

fix material count in material navigation popup #4227

Draft
wants to merge 1 commit into
base: prepare/150.0.x
Choose a base branch
from

Conversation

eugene-doobu
Copy link
Member

Description

재화 popup ui에 소수점이 있는 경우 무시하지 않고 보여줍니다

How to test

화면 상단의 소지중인 재화 혹은 포인트 UI를 클릭해서 팝업창을 확인합니다

Related Links

#4212

@eugene-doobu eugene-doobu self-assigned this Feb 22, 2024
@eugene-doobu eugene-doobu requested a review from a team as a code owner February 22, 2024 08:38

This PR has 5 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Extra Small
Size       : +3 -2
Percentile : 2%

Total files changed: 1

Change summary by file extension:
.cs : +3 -2

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detected.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful? 👍  :ok_hand:  :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

Comment on lines +143 to +145
if (itemCount.Contains(".") && float.TryParse(itemCount, out var floatCount))
itemCount = $"{floatCount:0.####}";
itemCountText.text = L10nManager.Localize("UI_COUNT_FORMAT", itemCount);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (itemCount.Contains(".") && float.TryParse(itemCount, out var floatCount))
itemCount = $"{floatCount:0.####}";
itemCountText.text = L10nManager.Localize("UI_COUNT_FORMAT", itemCount);
itemCountText.text = L10nManager.Localize("UI_COUNT_FORMAT", itemCount);

그냥 itemCount를 split하거나 하지 않고 바로 쓰면 안되나요?

Copy link
Member Author

Choose a reason for hiding this comment

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

소수점이 엄청 길어지는 상황이 생기고 이것이 보기 안 좋을 수 있어서 4자리로 제한을 뒀습니다

Copy link
Member

Choose a reason for hiding this comment

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

어프루브를 누르긴 했는데, 생각해보니 float 말고 double이나 decimal로 TryParse 하는게 좋겠습니다. 여기 들어갈 값들이면 전부 원본 값이 long 아니면 BigInteger일거라서...

Copy link
Contributor

Choose a reason for hiding this comment

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

아래 현님의 사례처럼 소수점이 길어지는 상황이 생기더라도 이 팝업의 역할이 재화의 값을 자세히 표시하는 거라 itemCount 그대로 사용해도 되지 않을까 싶긴 합니다. 재화 값이 그렇게 극단적으로 길어지는 경우가 거의 없기도 하구요...

@U-lis
Copy link
Contributor

U-lis commented Feb 22, 2024

이거 crystal 개수에도 영향을 줄까요? crystal 은 소수점 아래로 18자리까지 있어서 잘못하면 지옥도가 펼쳐질 수 있습니다.

{
            "currency": {
              "ticker": "CRYSTAL"
            },
            "quantity": "7428000049.9999999994252"
          },

이런게 존재할 수 있습니다.

@eugene-doobu
Copy link
Member Author

이거 crystal 개수에도 영향을 줄까요? crystal 은 소수점 아래로 18자리까지 있어서 잘못하면 지옥도가 펼쳐질 수 있습니다.

{
            "currency": {
              "ticker": "CRYSTAL"
            },
            "quantity": "7428000049.9999999994252"
          },

이런게 존재할 수 있습니다.

일단은 소수점 4자리까지만 출력하도록 제한하였습니다

var split = itemCount.Split('.');
itemCountText.text = L10nManager.Localize("UI_COUNT_FORMAT", split[0]);

if (itemCount.Contains(".") && float.TryParse(itemCount, out var floatCount))
Copy link
Member

Choose a reason for hiding this comment

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

float 말고 double이나 decimal로 TryParse 하는게 좋겠습니다. 여기 들어갈 값들이면 전부 원본 값이 long 아니면 BigInteger일거라서...

Copy link
Member

@ipdae ipdae left a comment

Choose a reason for hiding this comment

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

수정된 코드의 클래스 이름을 봐서는 NCG에만 쓰이는게 아니라 다른 재화들에도 사용이 되고, 이 경우엔 소수점표시가 필요없는데도 소수점이 표시된다던지할 가능성이 있어보이는데 괜찮을까요?

@eugene-doobu
Copy link
Member Author

수정된 코드의 클래스 이름을 봐서는 NCG에만 쓰이는게 아니라 다른 재화들에도 사용이 되고, 이 경우엔 소수점표시가 필요없는데도 소수점이 표시된다던지할 가능성이 있어보이는데 괜찮을까요?

출력 조건을 명확히 확인해보도록 하겠습니다

@tyrosine1153
Copy link
Contributor

수정된 코드의 클래스 이름을 봐서는 NCG에만 쓰이는게 아니라 다른 재화들에도 사용이 되고, 이 경우엔 소수점표시가 필요없는데도 소수점이 표시된다던지할 가능성이 있어보이는데 괜찮을까요?

재화 타입에 따라 구분해서 NCG, Crystal 같이 소수점 표시가 필요한 재화만 GetQuantityString()으로 받아오고 있습니다.
pr에서 수정된 Show() 메서드에서는 그런 countText를 받아서 소수점 없애는 역할만 해서 없던 소수점이 생길 일은 없습니다.

@eugene-doobu eugene-doobu marked this pull request as draft March 4, 2024 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UI] NCG 팝업에서 NCG 수량 소수점 이하 미 출력
5 participants