Complex formula in server action

I have a server action that gets data from an API call and some values are then stored in my database

So I first have the api call and then a database insert action

In this db record I need to store a value that needs a (complex) formula to calculate it’s value based on different values from the api call

So in the value field I have build this formula but now I wonder is this is the right way/place to do this calculation…

This is the formula:

This is how it looks:

Is this the way to go?

Community Page
Last updated: