Repository navigation
Closed
Labels
Awaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.DailyKSv2KSv2
Description
Context
We just recently merged #34983, which adds support for multiple levels of tags in the App.
Problem
However, one consideration we missed with the above project was that tags can be reordered, and that this order does not get preserved by the API when sending tags over as a JSON Object. In other words, the following tag list in our database:
Tags in DB Form
"tagLists":
[
{
"tagListData":
{
"name": "Project",
"tags":
[
{
"name": "Project 1",
"GL Code": "10",
"enabled": true
},
{
"name": "Project 2",
"GL Code": "20",
"enabled": true
},
{
"name": "Project 3",
"GL Code": "30",
"enabled": true
},
{
"name": "Project 4",
"GL Code": "40",
"enabled": true
},
{
"name": "Project 5",
"GL Code": "50",
"enabled": true
},
{
"name": "Project 6",
"GL Code": "60",
"enabled": true
}
],
"required": true
}
},
{
"tagListData":
{
"name": "Region",
"tags":
[
{
"name": "Africa",
"GL Code": "300",
"enabled": true
},
{
"name": "Asia",
"GL Code": "500",
"enabled": true
},
{
"name": "Australia",
"GL Code": "600",
"enabled": true
},
{
"name": "Europe",
"GL Code": "400",
"enabled": true
},
{
"name": "North America",
"GL Code": "100",
"enabled": true
},
{
"name": "South America",
"GL Code": "200",
"enabled": true
}
],
"required": true
}
},
{
"tagListData":
{
"name": "Department",
"tags":
[
{
"name": "Accounting",
"GL Code": "1000",
"enabled": true
},
{
"name": "Engineering",
"GL Code": "5000",
"enabled": true
},
{
"name": "HR",
"GL Code": "4000",
"enabled": true
},
{
"name": "Marketing",
"GL Code": "2000",
"enabled": true
},
{
"name": "Ops",
"GL Code": "6000",
"enabled": true
},
{
"name": "Sales",
"GL Code": "3000",
"enabled": true
}
],
"required": true
}
}
],
Would get translated to the following in Onyx, where the order is alphabetical for the keys:
Tags in Onyx Form
{
"key": "policyTags_D2B2C46682504F5A",
"onyxMethod": "set",
"value": {
"Department": {
"name": "Department",
"required": true,
"tags": {
"Accounting": {
"GL Code": "1000",
"enabled": true,
"name": "Accounting"
},
"Engineering": {
"GL Code": "5000",
"enabled": true,
"name": "Engineering"
},
"HR": {
"GL Code": "4000",
"enabled": true,
"name": "HR"
},
"Marketing": {
"GL Code": "2000",
"enabled": true,
"name": "Marketing"
},
"Ops": {
"GL Code": "6000",
"enabled": true,
"name": "Ops"
},
"Sales": {
"GL Code": "3000",
"enabled": true,
"name": "Sales"
}
}
},
"Project": {
"name": "Project",
"required": true,
"tags": {
"Project 1": {
"GL Code": "10",
"enabled": true,
"name": "Project 1"
},
"Project 2": {
"GL Code": "20",
"enabled": true,
"name": "Project 2"
},
"Project 3": {
"GL Code": "30",
"enabled": true,
"name": "Project 3"
},
"Project 4": {
"GL Code": "40",
"enabled": true,
"name": "Project 4"
},
"Project 5": {
"GL Code": "50",
"enabled": true,
"name": "Project 5"
},
"Project 6": {
"GL Code": "60",
"enabled": true,
"name": "Project 6"
}
}
},
"Region": {
"name": "Region",
"required": true,
"tags": {
"Africa": {
"GL Code": "300",
"enabled": true,
"name": "Africa"
},
"Asia": {
"GL Code": "500",
"enabled": true,
"name": "Asia"
},
"Australia": {
"GL Code": "600",
"enabled": true,
"name": "Australia"
},
"Europe": {
"GL Code": "400",
"enabled": true,
"name": "Europe"
},
"North America": {
"GL Code": "100",
"enabled": true,
"name": "North America"
},
"South America": {
"GL Code": "200",
"enabled": true,
"name": "South America"
}
}
}
}
},
This causes the wrong tag level to be pulled from the code in NewDot that accesses tags by "index"
Solution
As discussed here (internal slack link), start sending an orderWeight with the JSON Object of tags sent to the App. This will be generated on the fly. Then use that orderWeight to retrieve the proper tag level in getTagList
Reacted by Michael (Mykhailo) Kravchenko
Metadata
Metadata
Assignees
Labels
Awaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.DailyKSv2KSv2
Type
Projects
- StatusShow more project fieldsMEDIUM
- StatusShow more project fieldsDone
Activity
melvin-bot commentedon Feb 21, 2024
Triggered auto assignment to @CortneyOfstad (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.[-]Ensure that [/-][+]Ensure that we preserve order of tags for multiple levels of tag lists[/+][-]Ensure that we preserve order of tags for multiple levels of tag lists[/-][+][MEDIUM] Ensure that we preserve order of tags for multiple levels of tag lists[/+]flodnv commentedon Feb 22, 2024
I am not yet in agreement with the solution - https://expensify.slack.com/archives/C03TQ48KC/p1708604069214659?thread_ts=1707328858.869149&cid=C03TQ48KC
CortneyOfstad commentedon Feb 26, 2024
@yuwenmemon so I tried reading through the linked comment above from @flodnv, and I am going to be honest — I have not a clue where we're at or what the next steps are. Do you have an update on where we're at with this so I can proceed from a BugZero perspective? Thanks!
flodnv commentedon Feb 26, 2024
Unassigning @CortneyOfstad, we don't need BugZero here 😕
After discussing, I agree with the proposed solution
11 remaining items
[-][MEDIUM] Ensure that we preserve order of tags for multiple levels of tag lists[/-][+][HOLD for payment 2024-03-14] [MEDIUM] Ensure that we preserve order of tags for multiple levels of tag lists[/+]melvin-bot commentedon Mar 7, 2024
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Mar 7, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.48-0 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
orderWeight#37471If no regressions arise, payment will be issued on 2024-03-14. 🎊
melvin-bot commentedon Mar 7, 2024
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
melvin-bot commentedon Mar 14, 2024
Skipping the payment summary for this issue since all the assignees are employees or vendors. If this is incorrect, please manually add the payment summary SO.
melvin-bot commentedon Mar 19, 2024
@yuwenmemon Eep! 4 days overdue now. Issues have feelings too...
yuwenmemon commentedon Mar 21, 2024
This is done, closing