Refactor duration parsing in SimCallHistoryService for improved accuracy
- Updated duration parsing logic to handle MMSST format (minutes, seconds, tenths) more effectively. - Ensured proper handling of duration strings by padding and extracting minutes and seconds accurately.
This commit is contained in:
parent
e02ff17217
commit
996e3c574e
@ -146,8 +146,13 @@ export class SimCallHistoryService {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Parse duration (320 = 32.0 seconds)
|
||||
const durationSec = Math.round(parseInt(durationStr, 10) / 10);
|
||||
// Parse duration - format is MMSST (minutes, seconds, tenths)
|
||||
// e.g., 36270 = 36 min 27.0 sec, 320 = 0 min 32.0 sec
|
||||
const durationVal = durationStr.padStart(5, "0"); // Ensure at least 5 digits
|
||||
const minutes = parseInt(durationVal.slice(0, -3), 10) || 0; // All but last 3 digits
|
||||
const seconds = parseInt(durationVal.slice(-3, -1), 10) || 0; // 2 digits before last
|
||||
// Last digit is tenths, which we ignore
|
||||
const durationSec = minutes * 60 + seconds;
|
||||
|
||||
// Parse charge: use tokens * 10 yen, or alt charge if location is "他社"
|
||||
let chargeYen: number;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user