이미제

This commit is contained in:
2026-10-20 08:54:01 +09:00
parent eb99be1210
commit e0dcc8c2b0
113 changed files with 7214 additions and 965 deletions
+19 -5
View File
@@ -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: {
@@ -141,7 +142,7 @@ const targetSchoolType = computed(() => {
return '초·중학교'
})
// 동네 기준 또는 구 기준 인근 고등학교 목록
// 동네 기준 또는 관할 시군구 기준 인근 고등학교 목록
const nearbyHighSchools = computed(() => {
const dong = props.regionDong || ''
const cleanDong = dong.trim()
@@ -158,10 +159,23 @@ const nearbyHighSchools = computed(() => {
}
}
// 3. 동네에 고등학교가 없으면 관할 구/시 또는 인접 구의 학교 상위 6개
for (const [gu, list] of Object.entries(schoolsIndex.bySigungu || {})) {
if (cleanDong.includes(gu) || gu.includes(cleanDong)) {
return list.slice(0, 6)
// 3. 동네에 고등학교가 없으면 동일 관할 시군구 학교 상위 6개 검색
const regInfo = getRegionByDong(cleanDong)
if (regInfo && regInfo.sigungu) {
const targetSigungu = regInfo.sigungu.trim()
const matchedBySigungu = []
for (const list of Object.values(schoolsIndex.byDong || {})) {
for (const sch of list) {
if (sch.sigungu && (sch.sigungu.includes(targetSigungu) || targetSigungu.includes(sch.sigungu))) {
if (!matchedBySigungu.some(m => m.code === sch.code)) {
matchedBySigungu.push(sch)
}
}
}
if (matchedBySigungu.length >= 6) break
}
if (matchedBySigungu.length > 0) {
return matchedBySigungu.slice(0, 6)
}
}