경과일 < 10 이면 값 대신 '10일부터 표시돼요' 안내. 초반 소표본+일회성으로 과대 추정되던 문제 완화. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,8 @@ const aiBullets = ref([]) // AI 재무 코멘트(현황 관찰)
|
||||
const aiTips = ref([]) // AI 절약 가이드(실행 제안)
|
||||
const forecast = ref(null) // 월말 예상 지출(결정적 계산, 일회성 큰 지출 제외)
|
||||
const forecastNote = ref('') // 예상 지출 근거 문장
|
||||
const forecastHint = ref('') // 초반(표본 부족)엔 값 대신 안내
|
||||
const FORECAST_MIN_DAYS = 10 // 이 날짜(경과일)부터 예상 지출 노출(초반 표본 부족·튐 방지)
|
||||
const forecastLoading = ref(false)
|
||||
const aiLoading = ref(false)
|
||||
|
||||
@@ -97,11 +99,17 @@ function robustDailyRate(days) {
|
||||
async function loadForecast() {
|
||||
forecast.value = null
|
||||
forecastNote.value = ''
|
||||
forecastHint.value = ''
|
||||
const isCurrent = year.value === now.getFullYear() && month.value === now.getMonth() + 1
|
||||
if (!isCurrent) return // 과거/미래 달은 추정 불필요
|
||||
const totalDays = daysInMonth(year.value, month.value)
|
||||
const elapsed = now.getDate()
|
||||
if (elapsed < 1) return
|
||||
// 초반엔 표본이 적어 추정이 크게 튀므로 일정 경과일 전에는 값 대신 안내만 표시
|
||||
if (elapsed < FORECAST_MIN_DAYS) {
|
||||
forecastHint.value = `${FORECAST_MIN_DAYS}일부터 표시돼요`
|
||||
return
|
||||
}
|
||||
forecastLoading.value = true
|
||||
try {
|
||||
const daily = await accountApi.budgetPeriod({ unit: 'DAY', year: year.value, month: month.value })
|
||||
@@ -468,7 +476,11 @@ onMounted(async () => {
|
||||
{{ expenseDelta.diff >= 0 ? '+' : '' }}{{ won(expenseDelta.diff) }}<template v-if="expenseDelta.pct !== null"> ({{ expenseDelta.pct >= 0 ? '+' : '' }}{{ expenseDelta.pct }}%)</template>
|
||||
</b>
|
||||
</div>
|
||||
<div v-if="forecastLoading && !forecast" class="ie-row forecast">
|
||||
<div v-if="forecastHint" class="ie-row forecast">
|
||||
<span>예상 지출 <small>{{ forecastHint }}</small></span>
|
||||
<b class="pending">—</b>
|
||||
</div>
|
||||
<div v-else-if="forecastLoading && !forecast" class="ie-row forecast">
|
||||
<span>예상 지출 <small>계산 중…</small></span>
|
||||
<b class="pending">···</b>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user