File tree Expand file tree Collapse file tree
cms/server/admin/handlers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3636 collections .MutableMapping = collections .abc .MutableMapping
3737
3838import tornado .web
39+ from sqlalchemy import case
3940
4041from cms .db import Contest , Question , Participation
4142from cmscommon .datetime import make_datetime
@@ -53,10 +54,20 @@ class QuestionsHandler(BaseHandler):
5354 def get (self , contest_id ):
5455 self .contest = self .safe_get_item (Contest , contest_id )
5556
57+ answered = case (
58+ [(
59+ (Question .reply_timestamp .is_ (None )) &
60+ (Question .ignored .is_ (False )),
61+ 0
62+ )],
63+ else_ = 1
64+ )
65+
5666 self .r_params = self .render_params ()
5767 self .r_params ["questions" ] = self .sql_session .query (Question )\
5868 .join (Participation )\
5969 .filter (Participation .contest_id == contest_id )\
70+ .order_by (answered )\
6071 .order_by (Question .question_timestamp .desc ())\
6172 .order_by (Question .id ).all ()
6273 self .render ("questions.html" , ** self .r_params )
You can’t perform that action at this time.
0 commit comments