@@ -268,7 +268,7 @@ def _get_examples(self, parser_name="reference"):
268268        # logs warning and returns an empty list if the parser plugin raises an 
269269        # exception for any reason. 
270270        try :
271-             page  =  examples .Page .from_raw (html = self ._get_prose ())
271+             page  =  examples .Page .from_raw (html = self ._get_prose (force_precheck = True ))
272272            parser  =  _load_example_parser (name = parser_name )
273273            if  getattr (parser , "uses_real_datas" , True ):
274274                datas  =  examples ._get_unique_real_inputs (self .year , self .day )
@@ -737,9 +737,16 @@ def _request_puzzle_page(self):
737737                    _ensure_intermediate_dirs (self .prose0_path )
738738                    self .prose0_path .write_text (text , encoding = "utf-8" )
739739
740-     def  _get_prose (self ):
740+     def  _get_prose (self ,  force_precheck = False ):
741741        # prefer to return full prose (i.e. part b is solved or unlocked) 
742742        # prefer to return prose with answers from same the user id as self.user.id 
743+         if  force_precheck :
744+             unlocked_files  =  [
745+                 * AOCD_DATA_DIR .glob ("*/"  +  self .prose1_path .name ),
746+                 * AOCD_DATA_DIR .glob ("*/"  +  self .prose2_path .name ),
747+             ]
748+             if  not  unlocked_files :
749+                 self ._request_puzzle_page ()
743750        for  path  in  self .prose2_path , self .prose1_path :
744751            if  path .is_file ():
745752                log .debug ("_get_prose cache hit %s" , path )
@@ -753,7 +760,8 @@ def _get_prose(self):
753760            log .debug ("_get_prose cache hit %s" , self .prose0_path )
754761            return  self .prose0_path .read_text (encoding = "utf-8" )
755762        log .debug ("_get_prose cache miss year=%d day=%d" , self .year , self .day )
756-         self ._request_puzzle_page ()
763+         if  not  force_precheck :
764+             self ._request_puzzle_page ()
757765        for  path  in  self .prose2_path , self .prose1_path , self .prose0_path :
758766            if  path .is_file ():
759767                log .debug ("_get_prose using %s" , path )
0 commit comments