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

Round decimal and eventually use a Decimal library #32

Closed
gentlementlegen opened this issue Sep 12, 2024 · 10 comments · Fixed by #35
Closed

Round decimal and eventually use a Decimal library #32

gentlementlegen opened this issue Sep 12, 2024 · 10 comments · Fixed by #35

Comments

@gentlementlegen
Copy link
Member

When using certain duration settings, the pricing doesn't round up and ends with a lot of decimals. In this case the number should be properly calculated and eventually truncated if needed. This happens for example when setting a time like Time: <1 Minute.

Originally posted by @gentlementlegen in ubiquibot/sandbox#23 (comment)

Copy link
Contributor

ubiquity-os bot commented Sep 19, 2024

Deadline Thu, Sep 19, 11:04 AM UTC
Beneficiary 0x6321286F9B73f427C72e1f9F1bC6b3d25eF06605

Tip

  • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address.
  • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
  • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.

@hhio618
Copy link
Contributor

hhio618 commented Sep 19, 2024

/start

Copy link
Contributor

ubiquity-os bot commented Sep 19, 2024

Deadline Thu, Sep 19, 11:04 AM UTC
Beneficiary 0x6321286F9B73f427C72e1f9F1bC6b3d25eF06605

Tip

  • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address.
  • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
  • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.

@0x4007
Copy link
Member

0x4007 commented Sep 20, 2024

Two start messages but only one assigned. This isn't right @gentlementlegen

Also it should assign and then post the start message.

@gentlementlegen
Copy link
Member Author

gentlementlegen commented Sep 20, 2024

@Keyrxng rfc

What I think happened is:

  • no user was assigned
  • a pull-request was linked to this issue, which triggers an assignment of the user opening that PR
  • the user somehow didn't get assigned (you can see from the timeline only the start message was triggered)
  • /start assigned the user and displayed the message again

It should have just said "You are already assigned to this task" because it should have been the case.

Copy link
Contributor

ubiquity-os bot commented Oct 3, 2024

 [ 75 WXDAI ] 

@hhio618
Contributions Overview
ViewContributionCountReward
IssueTask175
ReviewComment80
Conversation Incentives
CommentFormattingRelevanceReward
Resolves #32```ts// Examples:console.log(custo…
0
content:
  content:
    p:
      score: 0
      elementCount: 1
    pre:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 2
  wordValue: 0
  result: 0
0.7-
Appreciate the heads-up!
0.65
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 4
  wordValue: 0.2
  result: 0.65
0.1-
Hi @gentlementlegen, I've added the unit tests! May I ask what t…
2.44
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 19
  wordValue: 0.2
  result: 2.44
0.8-
@gentlementlegen, I see you've been working with a testing deplo…
8.38
content:
  content:
    p:
      score: 0
      elementCount: 3
    pre:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 81
  wordValue: 0.2
  result: 8.38
0.9-
## QAPlease refer to this Github issue:https://github.com/Ub…
3.11
content:
  content:
    h2:
      score: 1
      elementCount: 1
    p:
      score: 0
      elementCount: 2
  result: 1
regex:
  wordCount: 16
  wordValue: 0.2
  result: 2.11
0.2-
Hey @gentlementlegen, I’ve thrown in a few more test cases. Also…
3.7
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 31
  wordValue: 0.2
  result: 3.7
0.6-
@gentlementlegen Yeah, that happens sometimes LOL, did a cleanup.
1.29
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 9
  wordValue: 0.2
  result: 1.29
0.3-
@gentlementlegen Is there anything else to complete before mergi…
1.42
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 10
  wordValue: 0.2
  result: 1.42
0.2-

 [ 2.717 WXDAI ] 

@0x4007
Contributions Overview
ViewContributionCountReward
IssueComment10.966
ReviewComment41.751
Conversation Incentives
CommentFormattingRelevanceReward
Two start messages but only one assigned. This isn't right @gent…
1.38
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 22
  wordValue: 0.1
  result: 1.38
0.70.966
Bad approach use a number library so rounding is accurate. You'r…
1
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 15
  wordValue: 0.1
  result: 1
0.90.9
Seems close
0.18
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 2
  wordValue: 0.1
  result: 0.18
0.20.036
Probably should add more tests with two decimals and more decim…
0.77
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 11
  wordValue: 0.1
  result: 0.77
0.70.539
Two seem appropriate like traditional currency.
0.46
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 6
  wordValue: 0.1
  result: 0.46
0.60.276

 [ 25.752 WXDAI ] 

@gentlementlegen
Contributions Overview
ViewContributionCountReward
IssueSpecification19.06
IssueComment17.71
ReviewComment118.982
Conversation Incentives
CommentFormattingRelevanceReward
When using certain duration settings, the pricing doesn't round …
3.02
content:
  content:
    p:
      score: 0
      elementCount: 2
    em:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 55
  wordValue: 0.1
  result: 3.02
19.06
@Keyrxng rfcWhat I think happened is:- no user was assigned…
10.85
content:
  content:
    p:
      score: 0
      elementCount: 7
    ul:
      score: 1
      elementCount: 1
    li:
      score: 0.5
      elementCount: 4
  result: 3
regex:
  wordCount: 75
  wordValue: 0.2
  result: 7.85
0.67.71
Please add the required tests, otherwise good to go with the PR.
0.83
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 12
  wordValue: 0.1
  result: 0.83
0.70.581
It seems your last commit added a lot of files that should not b…
1.33
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 21
  wordValue: 0.1
  result: 1.33
0.60.798
Maybe add a test with `0.73 hours` or things like that t…
1.06
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 16
  wordValue: 0.1
  result: 1.06
0.80.848
I think you can use `as unknown as Context` to avoid dis…
0.59
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 8
  wordValue: 0.1
  result: 0.59
0.90.531
Should be removed.
0.25
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 3
  wordValue: 0.1
  result: 0.25
0.40.1
Should be removed.
0.25
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 3
  wordValue: 0.1
  result: 0.25
0.40.1
Should be removed.
0.25
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 3
  wordValue: 0.1
  result: 0.25
0.40.1
Could you add:- unit tests- a link to a QA test
2.77
content:
  content:
    p:
      score: 0
      elementCount: 3
    ul:
      score: 1
      elementCount: 1
    li:
      score: 0.5
      elementCount: 2
  result: 2
regex:
  wordCount: 11
  wordValue: 0.1
  result: 0.77
0.752.5775
@hhio618 Thank you. If you could try running it in your org with…
2.83
content:
  content:
    p:
      score: 0
      elementCount: 2
    hr:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 51
  wordValue: 0.1
  result: 2.83
0.651.8395
@hhio618 This might help you get started: https://github.com/ubi…
2.45
content:
  content:
    p:
      score: 0
      elementCount: 2
  result: 0
regex:
  wordCount: 43
  wordValue: 0.1
  result: 2.45
0.51.225
No, just a second pair of eyes, when @0x4007 approves it will ge…
0.94
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 14
  wordValue: 0.1
  result: 0.94
0.30.282

@0x4007
Copy link
Member

0x4007 commented Oct 3, 2024

@gentlementlegen my link doesn't work

@gentlementlegen
Copy link
Member Author

gentlementlegen commented Oct 3, 2024

@0x4007 This error seems familiar: https://github.com/ubiquity-os-marketplace/conversation-rewards/actions/runs/11165001249/job/31035657102#step:7:463

Error: Failed to get token decimals for token: 0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d
    at ZB (/home/runner/work/conversation-rewards/conversation-rewards/node_modules/@ubiquibot/permit-generation/dist/core/index-BeQ_V1CH.js:31:1707)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async nb (/home/runner/work/conversation-rewards/conversation-rewards/node_modules/@ubiquibot/permit-generation/dist/core/index-BeQ_V1CH.js:31:4773)
    at PermitGenerationModule.transform (/home/runner/work/conversation-rewards/conversation-rewards/src/parser/permit-generation-module.ts:101:25)
    at Processor.run (/home/runner/work/conversation-rewards/conversation-rewards/src/parser/processor.ts:37:24)
    at run (/home/runner/work/conversation-rewards/conversation-rewards/src/run.ts:25:5)

@0x4007
Copy link
Member

0x4007 commented Oct 8, 2024

@0x4007 This error seems familiar: https://github.com/ubiquity-os-marketplace/conversation-rewards/actions/runs/11165001249/job/31035657102#step:7:463

Error: Failed to get token decimals for token: 0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d
    at ZB (/home/runner/work/conversation-rewards/conversation-rewards/node_modules/@ubiquibot/permit-generation/dist/core/index-BeQ_V1CH.js:31:1707)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async nb (/home/runner/work/conversation-rewards/conversation-rewards/node_modules/@ubiquibot/permit-generation/dist/core/index-BeQ_V1CH.js:31:4773)
    at PermitGenerationModule.transform (/home/runner/work/conversation-rewards/conversation-rewards/src/parser/permit-generation-module.ts:101:25)
    at Processor.run (/home/runner/work/conversation-rewards/conversation-rewards/src/parser/processor.ts:37:24)
    at run (/home/runner/work/conversation-rewards/conversation-rewards/src/run.ts:25:5)

@whilefoo can you make a fix for this?

Copy link
Contributor

ubiquity-os-beta bot commented Nov 2, 2024

 [ 75 WXDAI ] 

@hhio618
Contributions Overview
ViewContributionCountReward
IssueTask175
ReviewComment80
Conversation Incentives
CommentFormattingRelevanceReward
Resolves #32```ts// Examples:console.log(custo…
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 2
  wordValue: 0
  result: 0
0.90
Appreciate the heads-up!
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 4
  wordValue: 0
  result: 0
0.20
Hi @gentlementlegen, I've added the unit tests! May I ask what t…
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 19
  wordValue: 0
  result: 0
0.70
@gentlementlegen, I see you've been working with a testing deplo…
0
content:
  content:
    p:
      score: 0
      elementCount: 3
  result: 0
regex:
  wordCount: 81
  wordValue: 0
  result: 0
0.80
## QAPlease refer to this Github issue:https://github.com/Ub…
1
content:
  content:
    h2:
      score: 1
      elementCount: 1
    p:
      score: 0
      elementCount: 2
  result: 1
regex:
  wordCount: 16
  wordValue: 0
  result: 0
0.50
Hey @gentlementlegen, I’ve thrown in a few more test cases. Also…
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 31
  wordValue: 0
  result: 0
0.70
@gentlementlegen Yeah, that happens sometimes LOL, did a cleanup.
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 9
  wordValue: 0
  result: 0
0.10
@gentlementlegen Is there anything else to complete before mergi…
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 10
  wordValue: 0
  result: 0
0.30

 [ 3.224 WXDAI ] 

@0x4007
Contributions Overview
ViewContributionCountReward
IssueComment31.465
ReviewComment41.759
Conversation Incentives
CommentFormattingRelevanceReward
Two start messages but only one assigned. This isn't right @gent…
1.38
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 22
  wordValue: 0.1
  result: 1.38
0.81.104
@gentlementlegen my link doesn't work
0.46
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 6
  wordValue: 0.1
  result: 0.46
0.40.184
@whilefoo can you make a fix for this?
0.59
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 8
  wordValue: 0.1
  result: 0.59
0.30.177
Bad approach use a number library so rounding is accurate. You'r…
1
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 15
  wordValue: 0.1
  result: 1
0.80.8
Seems close
0.18
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 2
  wordValue: 0.1
  result: 0.18
0.20.036
Probably should add more tests with two decimals and more decim…
0.77
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 11
  wordValue: 0.1
  result: 0.77
0.90.693
Two seem appropriate like traditional currency.
0.46
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 6
  wordValue: 0.1
  result: 0.46
0.50.23

 [ 22.192 WXDAI ] 

@gentlementlegen
Contributions Overview
ViewContributionCountReward
IssueSpecification19.06
IssueComment26.067
ReviewComment117.065
Conversation Incentives
CommentFormattingRelevanceReward
When using certain duration settings, the pricing doesn't round …
3.02
content:
  content:
    p:
      score: 0
      elementCount: 2
    em:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 55
  wordValue: 0.1
  result: 3.02
19.06
@Keyrxng rfcWhat I think happened is:- no user was assigned…
5.92
content:
  content:
    p:
      score: 0
      elementCount: 7
    ul:
      score: 0
      elementCount: 1
    li:
      score: 0.5
      elementCount: 4
  result: 2
regex:
  wordCount: 75
  wordValue: 0.1
  result: 3.92
0.85.136
@0x4007 This error seems familiar: https://github.com/ubiquity-o…
1.33
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 21
  wordValue: 0.1
  result: 1.33
0.70.931
Please add the required tests, otherwise good to go with the PR.
0.83
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 12
  wordValue: 0.1
  result: 0.83
0.70.581
It seems your last commit added a lot of files that should not b…
1.33
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 21
  wordValue: 0.1
  result: 1.33
0.81.064
Maybe add a test with `0.73 hours` or things like that t…
1.06
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 16
  wordValue: 0.1
  result: 1.06
0.60.636
I think you can use `as unknown as Context` to avoid dis…
0.59
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 8
  wordValue: 0.1
  result: 0.59
0.90.531
Should be removed.
0.25
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 3
  wordValue: 0.1
  result: 0.25
0.30.075
Should be removed.
0.25
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 3
  wordValue: 0.1
  result: 0.25
0.30.075
Should be removed.
0.25
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 3
  wordValue: 0.1
  result: 0.25
0.30.075
Could you add:- unit tests- a link to a QA test
1.77
content:
  content:
    p:
      score: 0
      elementCount: 3
    ul:
      score: 0
      elementCount: 1
    li:
      score: 0.5
      elementCount: 2
  result: 1
regex:
  wordCount: 11
  wordValue: 0.1
  result: 0.77
0.71.539
@hhio618 Thank you. If you could try running it in your org with…
2.83
content:
  content:
    p:
      score: 0
      elementCount: 2
    hr:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 51
  wordValue: 0.1
  result: 2.83
0.51.415
@hhio618 This might help you get started: https://github.com/ubi…
2.45
content:
  content:
    p:
      score: 0
      elementCount: 2
  result: 0
regex:
  wordCount: 43
  wordValue: 0.1
  result: 2.45
0.40.98
No, just a second pair of eyes, when @0x4007 approves it will ge…
0.94
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 14
  wordValue: 0.1
  result: 0.94
0.10.094

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants