INNER CODE UNIT · JavaScript

visibleCandidates

Dsadd4/AgentFigureGallery · frontend/reference_gallery/app.js:147

function visibleCandidates() {
  if (!state.session) return [];
  const query = state.query.trim().toLowerCase();
  return state.session.candidates.filter((candidate) => {
    const typeLiked = candidate.status === "liked" || candidate.status === "selected";
    const globallyRejected = candidate.global_status === "global_rejected";
    if (state.filter === "all" && globallyRejected) return false;
    if (state.filter === "candidate" && (globallyRejected || candidate.status !== "candidate")) return false;
    if (state.filter === "liked" && (!typeLiked || globallyRejected)) return false;
    if (state.filter === "global_liked" && candidate.global_status !== "global_liked") return false;
    if (state.filter === "selected" && (candidate.status !== "selected" || globallyRejected)) return false;
    if (state.filter === "rejected" && candidate.status !== "rejected" && !globallyRejected) return false;
    if (state.source !== "all" && candidate.source_repo !== state.source) return false;
    if (query && !candidateText(candidate).includes(query)) return false;
    return true;
  });
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…