feat: 그날 코디 계절감 — 구간을 아침 체감·낮 최고 평균으로, 쌀쌀한 날부터 겉옷 있는 스냅만·미니·뮬/슬링백 제외, 여자 코디는 고프코어 감점
This commit is contained in:
1 parent
d8c406b8b8
commit
b8117f190d
2 files changed
+18
-6
No files matched your search
@@ -22,8 +22,11 @@ export async function weatherToday() {
|
||||
const day = withTemp.filter((s) => hour(s) >= 6 && hour(s) <= 21)
|
||||
const t = day.length ? day : withTemp
|
||||
const maxC = Math.round(Math.max(...t.map((s) => s.temp_c)))
|
||||
const morningC = Math.round((t.find((s) => hour(s) === 6) ?? t[0]).temp_c)
|
||||
const band = spec.bands.find((b) => maxC >= b.from) ?? spec.bands[spec.bands.length - 1]
|
||||
const morning = t.find((s) => hour(s) === 6) ?? t[0]
|
||||
const morningC = Math.round(morning.temp_c)
|
||||
// 낮 최고만 보면 아침·저녁 추위를 놓친다: 아침 체감과 낮 최고의 평균으로 구간을 정한다
|
||||
const feelC = ((morning.feels_c ?? morning.temp_c) + maxC) / 2
|
||||
const band = spec.bands.find((b) => feelC >= b.from) ?? spec.bands[spec.bands.length - 1]
|
||||
return { day: d.day, morningC, maxC, band: band.id, layering: band.layering ?? '' }
|
||||
}
|
||||
|
||||
|
||||
+13
-4
@@ -36,15 +36,17 @@ export const PERSONAS = {
|
||||
const HEAVY = /패딩|푸퍼|다운|롱코트|울코트|무스탕|플리스|기모|헤비|퍼 /i
|
||||
const MID = /코트|자켓|재킷|점퍼|블루종|집업/i
|
||||
const SHORTS = /쇼츠|반바지|shorts|숏팬츠|버뮤다/i
|
||||
const OPEN_SHOES = /뮬|슬링백|샌들|슬리퍼|mule|slingback|sandal/i
|
||||
const MINI = /미니 ?(스커트|드레스|원피스)|mini (skirt|dress)/i
|
||||
const SHORT_SLEEVE = /반팔|하프 슬리브|half sleeve|슬리브리스|민소매|sleeveless/i
|
||||
const BAND = {
|
||||
hot: { tags: ['여름코디', '간절기코디'], rejectGoods: [HEAVY, MID], rejectTags: [/겨울|패딩|코트/] },
|
||||
warm: { tags: ['간절기코디', '가을코디'], rejectGoods: [HEAVY, MID], rejectTags: [/겨울|패딩|코트/] },
|
||||
mild: { tags: ['가을코디', '간절기코디'], rejectGoods: [HEAVY, SHORTS], rejectTags: [/겨울|패딩/] },
|
||||
cool: { tags: ['가을코디', '가을아우터'], rejectGoods: [HEAVY, SHORTS, SHORT_SLEEVE], rejectTags: [/겨울/] },
|
||||
chilly: { tags: ['가을코디', '겨울코디'], rejectGoods: [/롱패딩|헤비/, SHORTS, SHORT_SLEEVE], rejectTags: [] },
|
||||
cold: { tags: ['겨울코디'], rejectGoods: [SHORTS, SHORT_SLEEVE], rejectTags: [/여름|반팔/] },
|
||||
freezing: { tags: ['겨울코디', '롱패딩'], rejectGoods: [SHORTS, SHORT_SLEEVE], rejectTags: [/여름|반팔|가을/] },
|
||||
cool: { needOuter: true, tags: ['가을코디', '가을아우터'], rejectGoods: [HEAVY, SHORTS, SHORT_SLEEVE], rejectTags: [/겨울/] },
|
||||
chilly: { needOuter: true, tags: ['가을코디', '겨울코디'], rejectGoods: [MINI, OPEN_SHOES, /롱패딩|헤비/, SHORTS, SHORT_SLEEVE], rejectTags: [] },
|
||||
cold: { needOuter: true, tags: ['겨울코디'], rejectGoods: [MINI, OPEN_SHOES, SHORTS, SHORT_SLEEVE], rejectTags: [/여름|반팔/] },
|
||||
freezing: { needOuter: true, tags: ['겨울코디', '롱패딩'], rejectGoods: [MINI, OPEN_SHOES, SHORTS, SHORT_SLEEVE], rejectTags: [/여름|반팔|가을/] },
|
||||
}
|
||||
// 철 지난 스냅은 뺀다
|
||||
const MAX_AGE_DAYS = 45
|
||||
@@ -141,6 +143,7 @@ function fits(snap, band) {
|
||||
const slots = new Set(snap.goods.map((g) => g.slot))
|
||||
const hasTop = slots.has('top') || slots.has('onepiece')
|
||||
const hasBottom = slots.has('bottom') || slots.has('onepiece')
|
||||
if (rule.needOuter && !slots.has('outer')) return false
|
||||
return hasTop && hasBottom && slots.has('shoes') && !!snap.image
|
||||
}
|
||||
|
||||
@@ -154,6 +157,12 @@ function score(snap, persona) {
|
||||
if (goods.some((g) => /슬랙스|로퍼|니트|블라우스|코트|자켓|재킷|셔츠/.test(g.name + g.category2))) s += 0.5
|
||||
if (goods.some((g) => /카고|후드|조거|스웨트/.test(g.name + g.category2))) s -= 1
|
||||
} else if (MATURE_TAG.test(tagBlob) && !/꾸안꾸|데일리/.test(tagBlob)) s -= 0.3
|
||||
// 여자 코디는 남성적인 고프코어보다 여성스러운 쪽을 고른다
|
||||
if (PERSONAS[persona].gender === 'WOMEN') {
|
||||
if (/페미닌|러블리|걸리시|여리여리|하객룩|오피스룩/.test(tagBlob)) s += 1
|
||||
if (goods.some((g) => /블라우스|가디건|스커트|원피스|로퍼|플랫|메리제인|니트/.test(g.name + g.category2))) s += 0.7
|
||||
if (goods.some((g) => /카고|백팩|트레일|고프코어|바람막이/.test(g.name + g.category2)) || /고프코어/.test(tagBlob)) s -= 1.5
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user