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

Handle template formulas in the report title field #33131

Closed
thienlnam opened this issue Dec 14, 2023 · 21 comments
Closed

Handle template formulas in the report title field #33131

thienlnam opened this issue Dec 14, 2023 · 21 comments
Assignees
Labels
Monthly KSv2 Reviewing Has a PR in review

Comments

@thienlnam
Copy link
Contributor

thienlnam commented Dec 14, 2023

When loading report fields, on app init we load the report fields for the primary policy

However for report titles, which can have a formula which contain things from here. There can be items that would only be known from the BE and so there is not a good way to handle this entirely optimistically on the FE.

Once the report is created, the changed report title should already be handled (as it pulls the report name from the BE on OpenReport) but the issue is in the draft report state.

In the draft report,

  • If the report formula is required, we can just add text denoting that this is required and cannot be changed (we'll just grab it when we open the report)
  • If the report formula is not required but does exist, we will pass the current formula value in OpenWorkspaceRequest and that will be used in the draft but can be modified to whatever the user expects
@thienlnam thienlnam added the Daily KSv2 label Dec 14, 2023
@thienlnam thienlnam self-assigned this Dec 14, 2023
Copy link

melvin-bot bot commented Dec 18, 2023

@thienlnam Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Dec 18, 2023
Copy link

melvin-bot bot commented Dec 18, 2023

@thienlnam Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Dec 20, 2023

@thienlnam Huh... This is 4 days overdue. Who can take care of this?

@thienlnam
Copy link
Contributor Author

Still need to investigate

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Dec 20, 2023
Copy link

melvin-bot bot commented Dec 26, 2023

@thienlnam Huh... This is 4 days overdue. Who can take care of this?

Copy link

melvin-bot bot commented Dec 28, 2023

@thienlnam Still overdue 6 days?! Let's take care of this!

Copy link

melvin-bot bot commented Jan 1, 2024

@thienlnam 10 days overdue. I'm getting more depressed than Marvin.

1 similar comment
Copy link

melvin-bot bot commented Jan 1, 2024

@thienlnam 10 days overdue. I'm getting more depressed than Marvin.

@thienlnam
Copy link
Contributor Author

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jan 2, 2024
Copy link

melvin-bot bot commented Jan 8, 2024

@thienlnam Huh... This is 4 days overdue. Who can take care of this?

@thienlnam
Copy link
Contributor Author

No update: Going to pass this back with the OpenDraftWorspaceRequest call

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jan 10, 2024
Copy link

melvin-bot bot commented Jan 15, 2024

@thienlnam Eep! 4 days overdue now. Issues have feelings too...

@thienlnam
Copy link
Contributor Author

Will work on this today

@melvin-bot melvin-bot bot removed the Overdue label Jan 16, 2024
@thienlnam thienlnam changed the title Figure out how to return template values to the FE for report fields Handle template values in the report title field Jan 16, 2024
@thienlnam thienlnam changed the title Handle template values in the report title field Handle template formulas in the report title field Jan 16, 2024
@thienlnam
Copy link
Contributor Author

thienlnam commented Jan 16, 2024

As I look into this, I am thinking of just passing back the formula title as the defaultValue on the reportField text_title. That should make it the most straightforward implementation. The only drawback is if we are offline, it will pull the last stored value which would be inaccurate (we could probably negate this with some offline UI handling that we would need to add in the offline required case anyways)

What do you think?

@thienlnam
Copy link
Contributor Author

Alternatively, I could store the value in another NVP policyDefaultTitle_

@allroundexperts
Copy link
Contributor

As I look into this, I am thinking of just passing back the formula title as the defaultValue on the reportField text_title. That should make it the most straightforward implementation. The only drawback is if we are offline, it will pull the last stored value which would be inaccurate (we could probably negate this with some offline UI handling that we would need to add in the offline required case anyways)

What do you think?

I think adding it in defaultValue field should be fine. However, I'm curious about where would you be saving the formula entered by the user then?

My recommendation here would be to let the defaultValue of the policyReportField be the raw formula that user entered and the value that is attached to the report, let that be the result after applying the formula.

@thienlnam
Copy link
Contributor Author

However, I'm curious about where would you be saving the formula entered by the user then?

Are you thinking in the future scenario where we allow the user to update the formula via NewDot? I was thinking the formula is not actually necessary in the FE because we aren't adding the ability to decode all formula values optimistically.

My recommendation here would be to let the defaultValue of the policyReportField be the raw formula that user entered and the value that is attached to the report, let that be the result after applying the formula.

I think this is ideal - and should happen automatically once openReport is called (should pull down the report title). The main issue is what happens with this draft report. OpenDraftWorkspace doesn't currently pass a reportID. Perhaps we can add the optimistic reportID to that and have the API send a pusher request to set the report title in onyx?

@melvin-bot melvin-bot bot added the Overdue label Jan 19, 2024
@thienlnam
Copy link
Contributor Author

Hmm actually, it's not like you set the report title during the creation of an IOU. Maybe we can do nothing here - if we're offline and the report title is enforced, we will make the field non-editable. Otherwise, it will default to the formula but can be updated, then once the user comes back online it will automatically update to the report field unless it was modified

@allroundexperts
Copy link
Contributor

allroundexperts commented Jan 22, 2024

PR: #34877
Closed above in favour of #34483

@melvin-bot melvin-bot bot removed the Weekly KSv2 label Feb 14, 2024
Copy link

melvin-bot bot commented Feb 14, 2024

This issue has not been updated in over 15 days. @allroundexperts, @thienlnam eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@melvin-bot melvin-bot bot added the Monthly KSv2 label Feb 14, 2024
@thienlnam
Copy link
Contributor Author

We decided to do nothing here - #33131 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Monthly KSv2 Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

2 participants