Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const TournamentTimeline: FC<Props> = async ({ tournament }) => {
: null
}
latestScheduledCloseTimestamp={getTimestampFromDateString(
tournament.forecasting_end_date
tournament.forecasting_end_date || tournament.close_date
)}
/>
) : (
Expand All @@ -60,7 +60,7 @@ const TournamentTimeline: FC<Props> = async ({ tournament }) => {
latest_scheduled_resolve_time
)}
latestActualCloseTimestamp={getTimestampFromDateString(
tournament.forecasting_end_date
tournament.forecasting_end_date || tournament.close_date
)}
isAllQuestionsResolved={all_questions_resolved}
latestActualResolutionTimestamp={getTimestampFromDateString(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import React, { PropsWithChildren } from "react";

const TournamentsContainer: React.FC<PropsWithChildren> = ({ children }) => {
return (
<main
className="mx-auto mb-6 mt-[52px] max-w-[1150px] px-3 sm:px-8"
id="tournamentsContainer"
>
<main className="mb-6 lg:mt-[52px]" id="tournamentsContainer">
{children}
</main>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ const TournamentsHeader: React.FC = () => {
<div
id="tournamentsStickyHeader"
className={cn(
"sticky z-40",
"ml-[calc(50%-50dvw)] w-[100dvw]",
!isLg && "-mt-[52px]",
"sticky top-12 z-40",
stuck || !isLg ? popoverSafeGlassClasses : "bg-transparent"
)}
style={{ top: STICKY_TOP }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const TournamentsScreen: React.FC<Props> = ({
current={current}
>
<TournamentsHeader />
<div className="mt-3 sm:mt-8">
<div className="mx-auto mt-3 max-w-[1150px] px-3 sm:mt-8 sm:px-8">
<TournamentsHero />
<TournamentsMobileCtrl />
<TournamentsResults className="mt-3 sm:mt-8 lg:mt-[50px]">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ export function selectTournamentsForSection(
return ongoing.filter(
(t) =>
t.type !== TournamentType.QuestionSeries &&
t.type !== TournamentType.Index
(t.type !== TournamentType.Index || !!t.prize_pool)
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ export function filterTournaments(
);

case TournamentsSortBy.StartDateDesc:
// Primary sort: Order
const orderDiff = (a.order ?? 0) - (b.order ?? 0);
if (orderDiff !== 0) {
return orderDiff;
}

return differenceInMilliseconds(
new Date(b.start_date),
new Date(a.start_date)
Expand Down
2 changes: 1 addition & 1 deletion front_end/src/components/ui/tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const TabsList = ({
return (
<div
className={cn(
"scrollbar-none z-10 -mx-4 flex overflow-x-auto bg-blue-200 px-4 py-3 dark:bg-blue-200-dark",
"scrollbar-none z-10 -mx-3 flex overflow-x-auto bg-blue-200 px-3 py-3 dark:bg-blue-200-dark sm:-mx-4 sm:px-4",
ctx.variant === "separated" ? "sticky top-12 gap-2" : "gap-2", // non-sticky for "group" to keep both behaviours valid
className
)}
Expand Down
1 change: 1 addition & 0 deletions front_end/src/types/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export type TournamentPreview = Project & {
followers_count?: number;
timeline: TournamentTimeline;
description_preview?: string;
order?: number;
};

export type TournamentTimeline = {
Expand Down
2 changes: 1 addition & 1 deletion projects/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Migration(migrations.Migration):
"order",
models.IntegerField(
default=0,
help_text="Will be displayed ordered by this field inside each section",
help_text="Will be displayed ordered by this field inside each section. Lower numbers appear first.",
),
),
(
Expand Down
2 changes: 1 addition & 1 deletion projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class BotLeaderboardStatus(models.TextChoices):
emoji = models.CharField(max_length=10, default="", blank=True)

order = models.IntegerField(
help_text="Will be displayed ordered by this field inside each section",
help_text="Will be displayed ordered by this field inside each section. Lower numbers appear first.",
default=0,
)

Expand Down
1 change: 1 addition & 0 deletions projects/serializers/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class Meta:
"html_metadata_json",
"is_ongoing",
"user_permission",
"order",
"created_at",
"edited_at",
"score_type",
Expand Down
10 changes: 6 additions & 4 deletions projects/services/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,13 @@ def get_max(data: list):


def get_project_timeline_data(project: Project):
# Fetch questions directly as per new requirement
questions = Question.objects.filter(
related_posts__post__default_project=project,
related_posts__post__curation_status=Post.CurationStatus.APPROVED,
).distinct("id")
related_posts__post_id__in=list(
Post.objects.filter_projects(project)
.filter(curation_status=Post.CurationStatus.APPROVED)
.values_list("id", flat=True)
)
)

return _calculate_timeline_data(project, questions)

Expand Down