@@ -681,8 +681,11 @@ public static function get_from_id(int $id, int $strictness = IGNORE_MISSING): ?
681681 * @param int $id
682682 * @return \stdClass|null
683683 */
684- private static function get_db_record_from_id (int $ id , int $ strictness ): ?object {
684+ protected static function get_db_record_from_id (int $ id , int $ strictness ): ?object {
685685 global $ DB ;
686+ self ::temp_log_query (static ::$ tablename , $ id , '' );
687+ //todo also failing behat tests https://github.com/ucl-isd/moodle-mod_coursework/actions/runs/22192548221/job/64184141521
688+ // (Mostly in deadline_extension tests)
686689 return $ DB ->get_record (static ::$ tablename , ['id ' => $ id ], '* ' , $ strictness ) ?: null ;
687690 }
688691
@@ -705,4 +708,24 @@ public function clear_cache() {
705708 $ cachetoclear ->delete ($ this ->submissionid );
706709 }
707710 }
711+
712+ public static function temp_log_query (string $ tablename , int $ id , string $ notes ) {
713+ //todo delete this.
714+ global $ DB ;
715+ if (optional_param ('logdb ' , false , PARAM_BOOL ) && is_siteadmin ()) {
716+
717+ if (optional_param ('display ' , false , PARAM_BOOL )) {
718+ \core \notification::info ($ tablename . ' ' . $ id . ' ' . $ notes );
719+ }
720+ $ ex = new \Exception ();
721+ $ log = (object )[
722+ 'classname ' => $ tablename ,
723+ 'requestedid ' => $ id ,
724+ 'notes ' => $ notes ,
725+ 'stacetrace ' => $ ex ->getTraceAsString (),
726+ 'timecreated ' => time ()
727+ ];
728+ $ DB ->insert_record ('coursework_temp_logs ' , $ log );
729+ }
730+ }
708731}
0 commit comments