Update calculate function to post data