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

Time Off App - Denied Time off still subtracts from total #131

Open
PrkchpsNaplsaws opened this issue Dec 26, 2023 · 1 comment
Open

Time Off App - Denied Time off still subtracts from total #131

PrkchpsNaplsaws opened this issue Dec 26, 2023 · 1 comment

Comments

@PrkchpsNaplsaws
Copy link

Describe the bug
As an "approver" when you "Decline" someone's request, the totals are still being updated to reflect the denied request as if it were approved, subtracting from the "AllottedTimeOff" Total.

To Reproduce

  • Have a user submit a request
  • Have an approver deny the request
  • See balances (note: For some reason, my Sharepoint lists are taking about 60 seconds to "update" through this process. It's probably a network issue, but keep an eye out for that on your end, apparently it's a known issue with SP lists?)

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
The code used to update the balances is as follows. It doesn't seem to differentiate between "Approved, Denied" in any way. I am not sure how to modify it to do such a thing.

Patch( TimeOffBalances, LookUp( TimeOffBalances, Employee.Email = selectedItem.'Created By'.Email && TimeOffType.Value = selectedItem.TimeOffType.Value ), { RequestedTimeOff: LookUp( TimeOffBalances, Employee.Email = selectedItem.'Created By'.Email && TimeOffType.Value = selectedItem.TimeOffType.Value ).RequestedTimeOff + selectedItem.Days } );

@PrkchpsNaplsaws
Copy link
Author

PrkchpsNaplsaws commented Dec 26, 2023

Seems as though I posted too soon - I kept messing around with it and appear to have figured something out that seems to be working. I added an "if" statement. I'm not sure if this is going to cause other issues that I haven't ran into yet, but updated code is below... and after some quick testing, it doens't seem to be updating the time off balance any longer if a request is rejected.

If(
    approveOrReject = "Approved",

Patch(
    TimeOffBalances,
    LookUp(
        TimeOffBalances,
        Employee.Email = selectedItem.'Created By'.Email && TimeOffType.Value = selectedItem.TimeOffType.Value
    ),
    {
        RequestedTimeOff: LookUp(
            TimeOffBalances,
            Employee.Email = selectedItem.'Created By'.Email && TimeOffType.Value = selectedItem.TimeOffType.Value
        ).RequestedTimeOff + selectedItem.Days
    }
)
,false)

;

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

No branches or pull requests

1 participant