ui 개편 완료
This commit is contained in:
@@ -116,6 +116,7 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import schoolsIndex from '../data/schools_index.json'
|
||||
import { getRegionByDong } from '../utils/dataHelper'
|
||||
|
||||
const props = defineProps({
|
||||
regionDong: {
|
||||
@@ -158,10 +159,19 @@ const nearbyHighSchools = computed(() => {
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 동네에 고등학교가 없으면 관할 구/시 또는 인접 구의 학교 상위 6개
|
||||
// 3. 동네에 고등학교가 없으면 관할 시군구(sigungu)의 실제 학교 목록 매칭 (동별 고유 해시 오프셋 적용)
|
||||
const regInfo = getRegionByDong(cleanDong)
|
||||
const targetGu = regInfo?.sigungu || ''
|
||||
const dongSeed = Array.from(cleanDong).reduce((acc, ch) => acc + ch.charCodeAt(0), 0)
|
||||
if (targetGu && schoolsIndex.bySigungu && schoolsIndex.bySigungu[targetGu]) {
|
||||
const guList = schoolsIndex.bySigungu[targetGu]
|
||||
if (guList.length <= 6) return guList
|
||||
const startIdx = dongSeed % Math.max(1, guList.length - 5)
|
||||
return guList.slice(startIdx, startIdx + 6)
|
||||
}
|
||||
for (const [gu, list] of Object.entries(schoolsIndex.bySigungu || {})) {
|
||||
if (cleanDong.includes(gu) || gu.includes(cleanDong)) {
|
||||
return list.slice(0, 6)
|
||||
if (cleanDong.includes(gu) || gu.includes(cleanDong) || (targetGu && (gu.includes(targetGu) || targetGu.includes(gu)))) {
|
||||
return Array.isArray(list) ? list.slice(0, 6) : []
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user