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

fix incorrect price calculation in sf orders ls #64

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/orders/OrderDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function orderDetails(order: HydratedOrder) {
const duration = dayjs(order.end_at).diff(order.start_at);
const durationInHours = duration === 0 ? 1 : duration / 1000 / 60 / 60;
const pricePerGPUHour =
(order.price * order.quantity) / GPUS_PER_NODE / durationInHours / 100;
order.price / (order.quantity * durationInHours * GPUS_PER_NODE) / 100;
Comment on lines 12 to +13
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: The price calculation for regular and executed prices are inconsistent. Regular price divides first while executed price multiplies first. This will give different results.

const durationFormatted = formatDuration(duration);

let executedPricePerGPUHour;
Expand Down