Add il bazlı filtreleme ve Türkiye harita bileşeni

Sonuç sayfasına bölge haritası ile il seçimi eklendi; searchByRank
artık il filtresini destekliyor. Paket adı tercihai olarak güncellendi.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
bilalgursen
2026-07-21 12:05:29 +03:00
parent 87f265ec15
commit 871012e87d
5 changed files with 290 additions and 10 deletions

View File

@@ -65,14 +65,17 @@ const EFEKTIF_SIRA = "COALESCE(sira2025, sira2024)";
export function searchByRank(
sira: number,
turKey: PuanTuruKey,
limitPerBucket = 12
opts: { il?: string; limitPerBucket?: number } = {}
): RankResults {
const db = getDb();
const tur = PUAN_TURLERI[turKey];
const onlisans = turKey === "tyt" ? 1 : 0;
const limitPerBucket = opts.limitPerBucket ?? 12;
const ilFiltre = opts.il ? "AND il = ?" : "";
const ilArgs = opts.il ? [opts.il] : [];
const base = `FROM programs
WHERE tur = ? AND onlisans = ? AND ${EFEKTIF_SIRA} IS NOT NULL
WHERE tur = ? AND onlisans = ? ${ilFiltre} AND ${EFEKTIF_SIRA} IS NOT NULL
AND ${EFEKTIF_SIRA} BETWEEN ? AND ?`;
// hayal: kullanıcıdan daha iyi taban sıralaması (sınıra en yakın olanlar önce)
@@ -80,12 +83,26 @@ export function searchByRank(
.prepare(
`SELECT ${SELECT_COLS} ${base} ORDER BY ${EFEKTIF_SIRA} DESC LIMIT ?`
)
.all(tur, onlisans, Math.round(sira * 0.5), sira - 1, limitPerBucket);
.all(
tur,
onlisans,
...ilArgs,
Math.round(sira * 0.5),
sira - 1,
limitPerBucket
);
// dengeli: tabanı kullanıcının sıralaması civarında
const dengeli = db
.prepare(`SELECT ${SELECT_COLS} ${base} ORDER BY ${EFEKTIF_SIRA} ASC LIMIT ?`)
.all(tur, onlisans, sira, Math.round(sira * 1.4), limitPerBucket);
.all(
tur,
onlisans,
...ilArgs,
sira,
Math.round(sira * 1.4),
limitPerBucket
);
// garanti: tabanı belirgin şekilde altında
const garanti = db
@@ -93,6 +110,7 @@ export function searchByRank(
.all(
tur,
onlisans,
...ilArgs,
Math.round(sira * 1.4) + 1,
Math.round(sira * 3),
limitPerBucket