Simplify: 100 - used percentage
This commit is contained in:
8
dist/index.js
vendored
8
dist/index.js
vendored
@@ -122,12 +122,10 @@ async function getMinimaxUsage() {
|
||||
const remainingMinutes = m.remains_time / 1000 / 60;
|
||||
const used = m.current_interval_usage_count;
|
||||
const total = m.current_interval_total_count;
|
||||
const pct = (used / total) * 100;
|
||||
const isRemainingPct = pct > 50;
|
||||
const finalPct = isRemainingPct ? 100 - pct : pct;
|
||||
const totalMinutes = remainingMinutes / (1 - used/total) || 0;
|
||||
const pct = 100 - ((used / total) * 100);
|
||||
const totalMinutes = remainingMinutes / (used / total) || 0;
|
||||
|
||||
return { pct: finalPct, remainingMinutes, totalMinutes, model: m.model_name, error: null };
|
||||
return { pct, remainingMinutes, totalMinutes, model: m.model_name, error: null };
|
||||
} catch (e) {
|
||||
return { pct: 0, remainingMinutes: 0, totalMinutes: 0, model: '?', error: e.message };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user