Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion front_end/messages/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@
"communityDisclaimer": "Přispěl <community></community> komunita. <learnMore>Dozvědět se více</learnMore>",
"communityDisclaimerSiteMain": "Tato otázka je také součástí hlavního Metaculus.",
"conditionalBranchResolutionAnnulled": "Tato větev byla zrušena, protože <link>nadřazená otázka</link> byla vyřešena <resolution></resolution>.",
"postNotebookMoveDateModalCopy": "Datum ukončení předpovědí turnaje je <b>{tournament_forecasting_end_date}</b> a snažíte se schválit otázku, která se uzavírá <b>{question_close_date}</b>. Chcete přemístit datum ukončení předpovědí turnaje na <b>{question_close_date}</b>?",
"postNotebookMoveDateModalCopy": "Datum ukončení předpovědí turnaje je <b>{tournament_close_date}</b> a snažíte se schválit otázku, která se uzavírá <b>{question_close_date}</b>. Chcete přemístit datum ukončení předpovědí turnaje na <b>{question_close_date}</b>?",
"moveDate": "Přemístit datum",
"addKeyFactor": "Přidat klíčový faktor",
"addKeyFactors": "Přidat klíčové faktory",
Expand Down
2 changes: 1 addition & 1 deletion front_end/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@
"communityDisclaimer": "Contributed by the <community></community> community. <learnMore>Learn more</learnMore>",
"conditionalBranchResolutionAnnulled": "This branch was annulled because the <link>parent question</link> resolved <resolution></resolution>.",
"communityDisclaimerSiteMain": "This question is also part of main Metaculus.",
"postNotebookMoveDateModalCopy": "The tournament forecasting end date is <b>{tournament_forecasting_end_date}</b> and you are trying to approve a question that closes on <b>{question_close_date}</b>. Do you want to move the tournament forecasting end date to <b>{question_close_date}</b>?",
"postNotebookMoveDateModalCopy": "The tournament close date is <b>{tournament_close_date}</b> and you are trying to approve a question that closes on <b>{question_close_date}</b>. Do you want to move the tournament close date to <b>{question_close_date}</b>?",
"moveDate": "Move date",
"addKeyFactor": "Add key factor",
"addDriver": "Add Driver",
Expand Down
2 changes: 1 addition & 1 deletion front_end/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@
"communityDisclaimer": "Contribuido por la comunidad de <community></community>. <learnMore>Más información</learnMore>",
"communityDisclaimerSiteMain": "Esta pregunta también forma parte de Metaculus principal.",
"conditionalBranchResolutionAnnulled": "Esta rama fue anulada porque la <link>pregunta principal</link> se resolvió <resolution></resolution>.",
"postNotebookMoveDateModalCopy": "La fecha de finalización de pronósticos del torneo es <b>{tournament_forecasting_end_date}</b> y estás tratando de aprobar una pregunta que cierra el <b>{question_close_date}</b>. ¿Quieres mover la fecha de finalización de pronósticos del torneo al <b>{question_close_date}</b>?",
"postNotebookMoveDateModalCopy": "La fecha de finalización de pronósticos del torneo es <b>{tournament_close_date}</b> y estás tratando de aprobar una pregunta que cierra el <b>{question_close_date}</b>. ¿Quieres mover la fecha de finalización de pronósticos del torneo al <b>{question_close_date}</b>?",
"moveDate": "Mover fecha",
"addKeyFactor": "Añadir factor clave",
"addKeyFactors": "Añadir factores clave",
Expand Down
2 changes: 1 addition & 1 deletion front_end/messages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@
"communityDisclaimer": "Contribuído pela comunidade <community></community>. <learnMore>Saiba mais</learnMore>",
"communityDisclaimerSiteMain": "Esta pergunta também faz parte do Metaculus principal.",
"conditionalBranchResolutionAnnulled": "Este ramo foi anulado porque a <link>pergunta pai</link> foi resolvida <resolution></resolution>.",
"postNotebookMoveDateModalCopy": "A data de término das previsões do torneio é <b>{tournament_forecasting_end_date}</b> e você está tentando aprovar uma pergunta que fecha em <b>{question_close_date}</b>. Deseja mover a data de término das previsões do torneio para <b>{question_close_date}</b>?",
"postNotebookMoveDateModalCopy": "A data de término das previsões do torneio é <b>{tournament_close_date}</b> e você está tentando aprovar uma pergunta que fecha em <b>{question_close_date}</b>. Deseja mover a data de término das previsões do torneio para <b>{question_close_date}</b>?",
"moveDate": "Mover data",
"addKeyFactor": "Adicionar fator chave",
"addKeyFactors": "Adicionar Fatores Chave",
Expand Down
2 changes: 1 addition & 1 deletion front_end/messages/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@
"communityDisclaimer": "由<community></community>社群提供。<learnMore>了解更多</learnMore>",
"conditionalBranchResolutionAnnulled": "此分支已取消,因為<link>父問題</link>解決了<resolution></resolution>。",
"communityDisclaimerSiteMain": "這個問題也是 Metaculus 主站的一部分。",
"postNotebookMoveDateModalCopy": "比賽預測的結束日期是<b>{tournament_forecasting_end_date}</b>,而你正嘗試批准一個截止日期為<b>{question_close_date}</b>的問題。你想將比賽預測的結束日期移動到<b>{question_close_date}</b>嗎?",
"postNotebookMoveDateModalCopy": "比賽預測的結束日期是<b>{tournament_close_date}</b>,而你正嘗試批准一個截止日期為<b>{question_close_date}</b>的問題。你想將比賽預測的結束日期移動到<b>{question_close_date}</b>嗎?",
"moveDate": "移動日期",
"addKeyFactor": "加入關鍵因素",
"addKeyFactors": "加入關鍵因素",
Expand Down
2 changes: 1 addition & 1 deletion front_end/messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@
"communityDisclaimer": "由<community></community>社区贡献。<learnMore>了解更多</learnMore>",
"communityDisclaimerSiteMain": "这个问题也是 Metaculus 主站的一部分。",
"conditionalBranchResolutionAnnulled": "此分支被取消,因为<link>父问题</link>解决<resolution></resolution>。",
"postNotebookMoveDateModalCopy": "比赛预测结束日期为 <b>{tournament_forecasting_end_date}</b>,而您正在尝试批准一个关闭日期为 <b>{question_close_date}</b> 的问题。您是否想将比赛预测结束日期移至 <b>{question_close_date}</b>?",
"postNotebookMoveDateModalCopy": "比赛预测结束日期为 <b>{tournament_close_date}</b>,而您正在尝试批准一个关闭日期为 <b>{question_close_date}</b> 的问题。您是否想将比赛预测结束日期移至 <b>{question_close_date}</b>?",
"moveDate": "移动日期",
"addKeyFactor": "添加关键因素",
"addKeyFactors": "添加关键因素",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const ClosedTournamentTimeline: FC<Props> = async ({
latestScheduledResolutionTimestamp = addDays(dateNowTimestamp, 1).getTime();
}

const endDateTimestamp = tournament.close_date
? new Date(tournament.close_date).getTime()
const endDateTimestamp = tournament.winners_announced_date
? new Date(tournament.winners_announced_date).getTime()
: addWeeks(
isAllQuestionsResolved
? latestActualResolutionTimestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ const TournamentStats = ({ tournament }: { tournament: Tournament }) => {
const isUpcoming =
new Date(tournament.start_date || "").getTime() > Date.now();
const forecastingClosed =
tournament.forecasting_end_date &&
new Date(tournament.forecasting_end_date).getTime() < Date.now();
tournament.close_date &&
new Date(tournament.close_date).getTime() < Date.now();
const questionsResolved = !!tournament.timeline.latest_actual_resolve_time;
return (
<div className="flex flex-col items-start gap-4 self-stretch @container">
Expand All @@ -114,7 +114,7 @@ const TournamentStats = ({ tournament }: { tournament: Tournament }) => {
</span>
</div>

{tournament.forecasting_end_date && (
{tournament.close_date && (
<div className="flex justify-between gap-4 @lg:flex-col @lg:justify-start @lg:gap-1">
<span className="text-xs font-medium uppercase text-gray-700 dark:text-gray-700-dark">
{forecastingClosed
Expand All @@ -123,7 +123,7 @@ const TournamentStats = ({ tournament }: { tournament: Tournament }) => {
:
</span>
<span className="text-right text-sm font-medium leading-4 text-gray-900 dark:text-gray-900-dark">
<LocalDaytime date={tournament.forecasting_end_date} />
<LocalDaytime date={tournament.close_date} />
</span>
</div>
)}
Expand All @@ -142,13 +142,13 @@ const TournamentStats = ({ tournament }: { tournament: Tournament }) => {
</span>
</div>
)}
{tournament.close_date && (
{tournament.winners_announced_date && (
<div className="flex justify-between gap-4 @lg:flex-col @lg:justify-start @lg:gap-1">
<span className="text-xs font-medium uppercase text-gray-700 dark:text-gray-700-dark">
{t("winnersAnnounced")}:
</span>
<span className="text-right text-sm font-medium leading-4 text-gray-900 dark:text-gray-900-dark">
<LocalDaytime date={tournament.close_date} />
<LocalDaytime date={tournament.winners_announced_date} />
</span>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ const HeaderBlockInfo: FC<Props> = async ({ tournament }) => {
text={formatDate(locale, new Date(tournament.start_date))}
/>
)}
{!isNil(tournament.close_date) && (
{!isNil(tournament.winners_announced_date) && (
<TournamentStat
title={t("EndDate")}
text={formatDate(locale, new Date(tournament.close_date))}
text={formatDate(locale, new Date(tournament.winners_announced_date))}
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const TournamentTimeline: FC<Props> = async ({ tournament }) => {
} = tournament.timeline;

const latestScheduledCloseTimestamp = getTimestampFromDateString(
tournament.forecasting_end_date || tournament.close_date
tournament.close_date || tournament.winners_announced_date
);

const nowTs = Date.now();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const TournamentsFilter: React.FC = () => {
},
{
label: t("endingSoon"),
value: TournamentsSortBy.CloseDateAsc,
value: TournamentsSortBy.WinnersAnnouncedDateAsc,
},
{
label: t("newest"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ const LiveTournamentCard: React.FC<Props> = ({
nowTs={nowTs}
timeline={item.timeline ?? null}
startDate={item.start_date ?? null}
forecastingEndDate={item.forecasting_end_date ?? null}
closeDate={item.close_date ?? null}
winnersAnnouncedDate={item.winners_announced_date ?? null}
isOngoing={Boolean(item.is_ongoing)}
/>
)}
Expand All @@ -103,19 +103,19 @@ function TournamentTimelineBar({
nowTs,
timeline,
startDate,
forecastingEndDate,
closeDate,
winnersAnnouncedDate,
isOngoing,
}: {
nowTs: number | null;
timeline: TournamentTimeline | null;
startDate?: string | null;
forecastingEndDate?: string | null;
closeDate?: string | null;
winnersAnnouncedDate?: string | null;
isOngoing: boolean;
}) {
const startTs = safeTs(startDate);
const closedTs = safeTs(forecastingEndDate ?? closeDate ?? null);
const closedTs = safeTs(closeDate ?? winnersAnnouncedDate ?? null);
if (!startTs || !closedTs) return null;

const now = nowTs ?? Date.now();
Expand All @@ -136,7 +136,7 @@ function TournamentTimelineBar({
<ClosedMiniBar
nowTs={now}
isResolved={isResolved}
closeDate={closeDate ?? null}
winnersAnnouncedDate={winnersAnnouncedDate ?? null}
timeline={timeline}
/>
);
Expand Down Expand Up @@ -196,12 +196,12 @@ function ClosedMiniBar({
nowTs,
isResolved,
timeline,
closeDate,
winnersAnnouncedDate,
}: {
nowTs: number | null;
isResolved: boolean;
timeline: TournamentTimeline | null;
closeDate: string | null;
winnersAnnouncedDate: string | null;
}) {
const t = useTranslations();
const label = isResolved
Expand All @@ -211,7 +211,7 @@ function ClosedMiniBar({

if (nowTs != null) {
const resolvedTs = pickResolveTs(nowTs, timeline);
const winnersTs = pickWinnersTs(resolvedTs, closeDate);
const winnersTs = pickWinnersTs(resolvedTs, winnersAnnouncedDate);

if (resolvedTs && nowTs >= resolvedTs) progress = 50;
if (winnersTs && nowTs >= winnersTs) progress = 100;
Expand Down Expand Up @@ -286,8 +286,8 @@ function pickResolveTs(nowTs: number, timeline: TournamentTimeline | null) {
return (isAllResolved ? actual : null) ?? effectiveScheduled ?? null;
}

function pickWinnersTs(resolvedTs: number | null, closeDate: string | null) {
const closeTs = safeTs(closeDate);
function pickWinnersTs(resolvedTs: number | null, winnersAnnouncedDate: string | null) {
const closeTs = safeTs(winnersAnnouncedDate);
if (closeTs) return closeTs;
return resolvedTs ? resolvedTs + TWO_WEEKS_MS : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { TournamentsSection } from "../types";

const archiveEndTs = (t: TournamentPreview) =>
[t.forecasting_end_date, t.close_date, t.start_date]
[t.close_date, t.winners_announced_date, t.start_date]
.map((s) => (s ? toDate(s.trim(), { timeZone: "UTC" }) : null))
.find((d) => d && isValid(d))
?.getTime() ?? 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ export function filterTournaments(
case TournamentsSortBy.PrizePoolDesc:
return Number(b.prize_pool) - Number(a.prize_pool);

case TournamentsSortBy.CloseDateAsc:
case TournamentsSortBy.WinnersAnnouncedDateAsc:
return differenceInMilliseconds(
new Date(a.close_date ?? 0),
new Date(b.close_date ?? 0)
new Date(a.winners_announced_date ?? 0),
new Date(b.winners_announced_date ?? 0)
);

case TournamentsSortBy.StartDateDesc:
Expand Down Expand Up @@ -97,7 +97,7 @@ const statusRank = (t: TournamentPreview, nowTs: number): number => {
const hasQuestions = t.questions_count > 0;
const allClosed = hasQuestions && !!t.timeline?.all_questions_closed;
const allResolved = hasQuestions && !!t.timeline?.all_questions_resolved;
const forecastEndTs = safeTs(t.forecasting_end_date);
const forecastEndTs = safeTs(t.close_date);
const forecastEnded = forecastEndTs != null && nowTs >= forecastEndTs;
const forecastOpen = forecastEndTs != null && !forecastEnded;

Expand All @@ -112,7 +112,7 @@ const orderValue = (t: TournamentPreview): number =>

const durationPctPassed = (t: TournamentPreview, nowTs: number): number => {
const startTs = safeTs(t.start_date);
const endTs = safeTs(t.forecasting_end_date ?? t.close_date);
const endTs = safeTs(t.close_date ?? t.winners_announced_date);
if (startTs == null || endTs == null || endTs <= startTs) {
return Number.POSITIVE_INFINITY;
}
Expand Down
2 changes: 1 addition & 1 deletion front_end/src/app/(main)/aib/minibench/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default async function MiniBenchPage() {
name={tournament.name}
questionsCount={tournament.questions_count}
closeDate={
tournament.forecasting_end_date || tournament.close_date
tournament.close_date || tournament.winners_announced_date
}
showCloseDate={
tournament.type !== TournamentType.QuestionSeries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const PostApprovalModal: FC<{
const [isLoading, setIsLoading] = useState(false);
const [submitErrors, setSubmitErrors] = useState<ErrorResponse>();
const [activeModal, setActiveModal] = useState<
"approvePost" | "confirmForecastingEndDate"
"approvePost" | "confirmCloseDate"
>();
const default_project = post.projects?.default_project;

Expand Down Expand Up @@ -161,23 +161,23 @@ const PostApprovalModal: FC<{
const handleApprovePostSubmit = useCallback(async () => {
if (!default_project) return;

const { forecasting_end_date, close_date } = default_project;
const { close_date, winners_announced_date } = default_project;
const { scheduled_close_time, scheduled_resolve_time } = approvalData;

// Checks whether given post potentially affects Project.forecasting_end_date value
// Checks whether given post potentially affects Project.close_date value
if (
// Show popup for single questions only
post.question &&
// Only eligible for Tournaments
default_project.type == TournamentType.Tournament &&
forecasting_end_date &&
close_date &&
winners_announced_date &&
scheduled_close_time &&
scheduled_resolve_time &&
isAfter(new Date(scheduled_close_time), new Date(forecasting_end_date)) &&
!isAfter(new Date(scheduled_resolve_time), new Date(close_date))
isAfter(new Date(scheduled_close_time), new Date(close_date)) &&
!isAfter(new Date(scheduled_resolve_time), new Date(winners_announced_date))
) {
setActiveModal("confirmForecastingEndDate");
setActiveModal("confirmCloseDate");
} else {
await handleApprove();
}
Expand Down Expand Up @@ -349,7 +349,7 @@ const PostApprovalModal: FC<{
</div>
</BaseModal>{" "}
<BaseModal
isOpen={activeModal == "confirmForecastingEndDate"}
isOpen={activeModal == "confirmCloseDate"}
label={t("postQuestionApproval")}
onClose={() => {
setIsOpen(false);
Expand All @@ -358,13 +358,9 @@ const PostApprovalModal: FC<{
<div className="flex max-w-sm flex-col gap-4">
<p className="text-base leading-tight">
{t.rich("postNotebookMoveDateModalCopy", {
tournament_forecasting_end_date:
default_project?.forecasting_end_date
? formatDate(
locale,
new Date(default_project.forecasting_end_date)
)
: "",
tournament_close_date: default_project?.close_date
? formatDate(locale, new Date(default_project.close_date))
: "",
question_close_date: approvalData.scheduled_close_time
? formatDate(
locale,
Expand Down
6 changes: 3 additions & 3 deletions front_end/src/components/posts_feed/feed_tournament_tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const FeedTournamentTile: FC<Props> = ({ tile, feedPage }) => {
const rawCloseTime =
rule === FeedTileRule.ALL_QUESTIONS_RESOLVED && project_resolution_date
? project_resolution_date
: project.close_date ??
project.forecasting_end_date ??
: project.winners_announced_date ??
project.close_date ??
project.start_date;
const rawCloseTs = safeTs(rawCloseTime) ?? Date.now() + 1000;
const scheduled_close_time = new Date(
Expand Down Expand Up @@ -158,7 +158,7 @@ function getStatusLabel(
): ReactNode | null {
const now = Date.now();
const startTs = safeTs(project.start_date);
const closeTs = safeTs(project.close_date);
const closeTs = safeTs(project.winners_announced_date);
const resolveTs = safeTs(project_resolution_date);

const strong = (chunks: ReactNode) => <strong>{chunks}</strong>;
Expand Down
4 changes: 2 additions & 2 deletions front_end/src/stories/feed_card/binary_group/mock_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export const getMockData = (isResolved: boolean, isFanChart?: boolean) => {
header_image: null,
prize_pool: null,
start_date: "2025-06-18T13:00:10Z",
winners_announced_date: null,
close_date: null,
forecasting_end_date: null,
meta_description: "",
is_ongoing: true,
user_permission: null,
Expand All @@ -82,8 +82,8 @@ export const getMockData = (isResolved: boolean, isFanChart?: boolean) => {
header_image: null,
prize_pool: null,
start_date: "2025-06-18T13:00:10Z",
winners_announced_date: null,
close_date: null,
forecasting_end_date: null,
meta_description: "",
is_ongoing: true,
user_permission: null,
Expand Down
Loading
Loading