reconcile official tender dates on detail open
Quality gates / test-build (push) Canceled after 0s
Quality gates / container (push) Canceled after 0s

This commit is contained in:
2026-09-06 20:42:21 +03:00
parent 3042ec58af
commit a268b15ad7
4 changed files with 74 additions and 4 deletions
+21 -3
View File
@@ -8,7 +8,7 @@ import React, {createContext, useContext, useState, useEffect, useMemo, useRef }
import { scanCompanyProposal } from '../services/companyProfile';
import { havuzuPuanla, profilMetni, profilTerimleri } from '../services/uyum';
import { getToken } from '../services/auth';
import { fetchLiveTenders, fetchTenderDetail, mergeUserState } from '../services/tenderApi';
import { fetchLiveTenders, fetchTenderDetail, fetchOfficialTenderDetail, mergeUserState } from '../services/tenderApi';
import { restoreSession, clearSession, getStoredUser } from '../services/auth';
import { getUserDataSnapshot, setUserData, getPlan, bildirimleriGetir, bildirimOkundu, listDocuments } from '../services/account';
import { applyTenderStates, tenderStateKey, tenderSnapshot, publicTender, tenderSourceChanges } from '../services/tenderState';
@@ -321,9 +321,27 @@ export const AppProvider = ({ children }) => {
const controller = new AbortController();
setDetailLoad({id:t.id,status:'loading'});
fetchTenderDetail(t.id, {signal:controller.signal})
.then(detail => {
.then(async detail => {
if (cancelled) return;
const source = publicTender(detail);
let enriched = detail;
if (t.id.startsWith('ilan-') && /^\d{4}\/\d+$/.test(String(t.ikn || '').replace(/[\s\u00a0]+/g, ''))) {
try {
const official = await fetchOfficialTenderDetail(t.ikn, { signal: controller.signal });
enriched = {
...detail,
...official,
// Keep the richer announcement text if EKAP returned only the
// compact metadata block.
aciklama: String(official.metin || '').length > String(detail.aciklama || '').length
? official.metin : detail.aciklama,
};
} catch (error) {
if (cancelled || controller.signal.aborted) return;
enriched = { ...detail, sourceWarning: `Resmî EKAP tarihi doğrulanamadı; ilan tarihi gösteriliyor. ${error.message}` };
}
}
if (cancelled) return;
const source = publicTender(enriched);
source.sourceChanges = tenderSourceChanges(savedTenderStates.current[tenderStateKey(t)]?.snapshot, {...t,...source});
setDetailLoad({id:t.id,status:'loaded'});
setActiveTenderDetail(prev =>