5151from sqlalchemy .orm import joinedload
5252
5353from cms import config
54- from cms .db import User , Participation , Team , Submission , Token , Task , Dataset
54+ from cms .db import User , Participation , Team , Submission , Task
5555from cms .grading .languagemanager import get_language
5656from cms .grading .steps import COMPILATION_MESSAGES , EVALUATION_MESSAGES
5757from cms .grading .scoring import task_score
@@ -78,7 +78,6 @@ class MainHandler(ContestHandler):
7878 """
7979 @multi_contest
8080 def get (self ):
81- self .r_params = self .render_params ()
8281 self .render ("overview.html" , ** self .r_params )
8382
8483 def render_params (self ):
@@ -91,7 +90,9 @@ def render_params(self):
9190 .filter (Participation .id == self .current_user .id )
9291 .options (
9392 joinedload (Participation .user ),
94- joinedload (Participation .contest ),
93+ joinedload (Participation .contest )
94+ .joinedload (Contest .tasks )
95+ .joinedload (Task .active_dataset ),
9596 joinedload (Participation .submissions ).joinedload (Submission .token ),
9697 joinedload (Participation .submissions ).joinedload (
9798 Submission .results
@@ -100,13 +101,9 @@ def render_params(self):
100101 .first ()
101102 )
102103
103- self .contest = (
104- self .sql_session .query (Contest )
105- .filter (Contest .id == participation .contest .id )
106- .options (joinedload (Contest .tasks ).joinedload (Task .active_dataset ))
107- .first ()
108- )
109-
104+ self .contest = participation .contest
105+ # Ensure the template sees this fully-loaded version
106+ ret ["contest" ] = self .contest
110107 ret ["participation" ] = participation
111108
112109 # Compute public scores for all tasks only if they will be shown
0 commit comments