@@ -338,8 +338,6 @@ run_add_record(
338338 uint64_t flags = 0 ;
339339 int run_to_ignore = -1 ;
340340
341- touch_last_update_time_us (state );
342-
343341 state -> uuid_hash_last_added_index = -1 ;
344342 state -> uuid_hash_last_added_run_id = -1 ;
345343 if (!is_hidden ) {
@@ -421,6 +419,8 @@ run_add_record(
421419 re .is_vcs = is_vcs ;
422420 flags |= RE_SIZE | RE_LOCALE_ID | RE_USER_ID | RE_LANG_ID | RE_PROB_ID | RE_STATUS | RE_TEST | RE_SCORE | RE_IP | RE_SSL_FLAG | RE_VARIANT | RE_IS_HIDDEN | RE_MIME_TYPE | RE_EOLN_TYPE | RE_STORE_FLAGS | RE_IS_VCS ;
423421
422+ touch_last_update_time_us (state );
423+
424424 int64_t serial_id = 0 ;
425425 if (state -> iface -> append_run ) {
426426 i = state -> iface -> append_run (state -> cnts , & re , flags , p_tv , & serial_id , puuid );
@@ -684,9 +684,10 @@ run_is_imported(runlog_state_t state, int runid)
684684int
685685run_start_contest (runlog_state_t state , time_t start_time )
686686{
687+ if (state -> head .start_time ) ERR_R ("Contest already started" );
688+
687689 touch_last_update_time_us (state );
688690
689- if (state -> head .start_time ) ERR_R ("Contest already started" );
690691 return state -> iface -> start (state -> cnts , start_time );
691692}
692693
@@ -1717,8 +1718,6 @@ run_virtual_start(
17171718 int i ;
17181719 struct run_entry re ;
17191720
1720- touch_last_update_time_us (state );
1721-
17221721 if (!state -> head .start_time ) {
17231722 err ("run_virtual_start: the contest is not started" );
17241723 return -1 ;
@@ -1732,6 +1731,9 @@ run_virtual_start(
17321731 err ("run_virtual_start: virtual contest for %d already started" , user_id );
17331732 return -1 ;
17341733 }
1734+
1735+ touch_last_update_time_us (state );
1736+
17351737 if (state -> iface -> user_run_header_set_start_time ) {
17361738 return state -> iface -> user_run_header_set_start_time (state -> cnts , user_id , t , 1 , user_id );
17371739 }
@@ -1779,8 +1781,6 @@ run_virtual_stop(
17791781 time_t exp_stop_time = 0 ;
17801782 struct run_entry re ;
17811783
1782- touch_last_update_time_us (state );
1783-
17841784 if (!state -> head .start_time ) {
17851785 err ("run_virtual_stop: the contest is not started" );
17861786 return -1 ;
@@ -1799,6 +1799,9 @@ run_virtual_stop(
17991799 err ("run_virtual_stop: virtual contest for %d already stopped" , user_id );
18001800 return -1 ;
18011801 }
1802+
1803+ touch_last_update_time_us (state );
1804+
18021805 if (state -> iface -> user_run_header_set_stop_time ) {
18031806 int duration = urh -> duration ;
18041807 if (duration <= 0 ) {
@@ -3179,12 +3182,12 @@ run_rebuild_user_run_index(runlog_state_t state, int user_id)
31793182int
31803183run_set_run_is_checked (runlog_state_t state , int run_id , int is_checked )
31813184{
3182- touch_last_update_time_us (state );
3183-
31843185 if (run_id < 0 || run_id >= state -> run_u ) ERR_R ("bad runid: %d" , run_id );
31853186 if (!state -> iface -> run_set_is_checked ) {
31863187 ERR_R ("run_set_is_checked is not implemented" );
31873188 } else {
3189+ touch_last_update_time_us (state );
3190+
31883191 return state -> iface -> run_set_is_checked (state -> cnts , run_id , is_checked );
31893192 }
31903193}
0 commit comments