Files
kolaytercih/src/lib/rapor-maske.ts
bilalgursen d93cf742ff
All checks were successful
Deploy / deploy (push) Successful in 2m38s
Update UI components and database schema
- Updated the `page.tsx` component to enhance user experience with new UI elements and improved layout.
- Modified the `funnel-banner.tsx` to include dynamic text and improved styling for better engagement.
- Adjusted the `liste-paneli.tsx` to provide clearer information on user credits and package details.
- Enhanced the `rapor-listesi.tsx` to display additional data points for better insights.
- Updated the database schema in `app.db` to reflect recent changes in the application logic.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-26 05:17:17 +03:00

44 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Paketsiz kullanıcıya giden raporun sunucu tarafı maskesi.
// YÖK Atlas'ın ham program ve taban sıralaması verileri ücretsiz kalır.
// Yalnızca AI'ın ürettiği kişisel gerekçe/risk/trend yorumu maskelenir;
// böylece istemciye ücretli analiz metni hiç inmez.
import type { RaporSonuc } from "./ai/rapor";
export const ACIK_SATIR = 3;
const SAHTE_GEREKCE =
"Bu tercih için kişisel gerekçe paketle açılır.";
const SAHTE_RISK =
"Sıralamana özel yerleşme riski paketle açılır.";
const SAHTE_TREND =
"Ham trend verisi ücretsizdir; AI yorumu paketle açılır.";
/** genelDegerlendirme'nin yalnızca ilk 1-2 cümlesini bırakır. */
function degerlendirmeKirp(metin: string): string {
const cumleler = metin.match(/[^.!?]+[.!?]+/g);
if (!cumleler || cumleler.length <= 2) return metin;
return `${cumleler.slice(0, 2).join(" ").trim()}`;
}
export function raporMaskele(rapor: RaporSonuc): RaporSonuc {
const tercihler = rapor.tercihler.map((t, i) =>
i < ACIK_SATIR
? t
: {
...t,
gerekce: SAHTE_GEREKCE,
riskNotu: SAHTE_RISK,
trendOzeti: SAHTE_TREND,
},
);
return {
tercihler,
genelDegerlendirme: degerlendirmeKirp(rapor.genelDegerlendirme),
uyarilar: rapor.uyarilar,
// Program adı, üniversite ve 20212025 taban sıralamaları ham veridir.
programlar: rapor.programlar,
};
}