Add new capability to set tracking rate and unit#6839
Conversation
|
Hey @marktoman 👋 Just want to point out there's a merge conflict and I'm waiting on testing instructions. Once you've added those I will review it. I also know it's the holidays, so no worries if you don't get to it till afterwards. |
|
Hi @marktoman - happy new year! Can you provide us with an ETA on fixing the merge conflict and adding the testing steps for @deetergp, please? It would be great to have this squared away this week if we can! |
|
Happy new year to you guys as well! I have updated the instruction and QA steps. Unfortunately, it does not build on windows for some reason, so I am not able to provide more platforms. |
|
Heya Mark, thank you for adding the instructions and screenshots, it makes life easier for everyone. Going through the testing steps, I'm experiencing issues with the settings persistence. If I Change the rate to |
|
Hi Scott, thank you for the review. I can replicate the problem. The issue is caused by All other scenarios seem to work, e.g.: Log out & in > refresh the page > navigate to Reimburse expenses. (It fetches the latest values and displays them correctly.) Do you think I should find a workaround like calling |
|
@marktoman Great questions! Since it looks like you've got some merge conflicts around |
|
@deetergp Merged and tested again — sadly no luck. |
|
@deetergp I have made it work the following way:
|
|
Hi Scott, curious about your opinion. I consider the second solution cleaner because it does not require adding sessions to |
deetergp
left a comment
There was a problem hiding this comment.
Overall it looks good and passes tests, thanks for sorting it out. I had a few minor requests mostly around variable declarations that only get used once and are unnecessary.
| updateLocalPolicyValues(policyID, {customUnit: localCustomUnit}); | ||
| }).catch(() => { | ||
| // Show the user feedback | ||
| const errorMessage = Localize.translateLocal('workspace.editor.genericFailureMessage'); |
There was a problem hiding this comment.
The errorMessage variable isn't really necessary, just call Localize.translateLocal inside the growl error.
| * @param {Object} values | ||
| */ | ||
| function setCustomUnit(policyID, values) { | ||
| const payload = { |
There was a problem hiding this comment.
No real need for this variable, just define this object inside the call to API.Policy_CustomUnit_Update.
| throw new Error(); | ||
| } | ||
|
|
||
| const localCustomUnit = { |
There was a problem hiding this comment.
Unnecessary variable, define in the function call.
| * @param {Object} values | ||
| */ | ||
| function setCustomUnitRate(policyID, customUnitID, values) { | ||
| const payload = { |
There was a problem hiding this comment.
Unnecessary variable declaration
| throw new Error(); | ||
| } | ||
|
|
||
| const localCustomUnitRate = { |
There was a problem hiding this comment.
Unnecessary variable declaration
| updateLocalPolicyValues(policyID, {customUnit: {rate: localCustomUnitRate}}); | ||
| }).catch(() => { | ||
| // Show the user feedback | ||
| const errorMessage = Localize.translateLocal('workspace.editor.genericFailureMessage'); |
There was a problem hiding this comment.
Unnecessary variable declaration
|
|
||
| this.setState({rateValue: numValue.toString()}); | ||
|
|
||
| const values = { |
There was a problem hiding this comment.
You only use this once, you don't need it.
| setUnit(value) { | ||
| this.setState({unitValue: value}); | ||
|
|
||
| const values = { |
deetergp
left a comment
There was a problem hiding this comment.
Looks good. Thanks for the changes!
|
@marktoman Your changes look good, but there's one slight snag: two of your four most recent commits (04bac5c & 93a37f2) contain unverified signatures which prevent me from being able to merge it. I think the right way to fix this will be to do the following (I HIGHLY recommend testing it on a copy of your branch first just to be safe):
Because the changes are after the last review, it shouldn't mess with the PR history adversely. |
|
@deetergp Thank you for all your help on this issue! |
deetergp
left a comment
There was a problem hiding this comment.
Looks great! Thanks for sticking with it, @marktoman!
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to production by @roryabraham in version: 1.1.36-0 🚀
|
|
Added a comment to the linked issue here, but I think we're displaying the decimals in the wrong place in the workspace editor setting. |
| kilometers: '', | ||
| miles: '', | ||
| viewAllReceipts: 'Ver todos los recibos', | ||
| reimburseReceipts: 'Reembolsar recibos', | ||
| trackDistance: '', | ||
| trackDistanceCopy: '', | ||
| trackDistanceRate: '', | ||
| trackDistanceUnit: '', |
There was a problem hiding this comment.
This is wrong, you need to complete the translations for this language.
Since it was not done, it generated a few alerts. I am going to post them in the original issue so you can get them fixed @marktoman.
@deetergp you should've not merged this
There was a problem hiding this comment.
Lo siento! 😬 Not sure how I missed that but will get some translations to Mark Toman, so he can add them.
There was a problem hiding this comment.
Oh did not see that, I just saw the bugbot issues and assumed it was still happening. Curious where were they added?
And yes, that's all we need to do to fix the issues.
There was a problem hiding this comment.
I'll close them as my penance. The changes were added in this commit by @PrashantMangukiya, whom I now owe a 🍺.




Details
Fixed Issues
$ #6213
Tests and QA Steps
Action 1
Steps
Result
The menu item is named "Reimburse expenses"
Action 2
Steps
Result
Values are preserved
Action 3
Steps
Result
Values are preserved
Action 4
Steps
Result
Miles is the value in Unit
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android