@@ -267,8 +267,6 @@ get_looks <- function(df,
267267 # operate WITHIN the current fixation pair (i.e., within a trial)
268268 for (i in min_fi : max_fi ) {
269269
270-
271-
272270 # get all hit names within current fixation index
273271 hit_names_in_fi <- df [[column_name ]][which(df $ fi == i )]
274272
@@ -469,13 +467,6 @@ get_looks <- function(df,
469467 first_looks_collection [[hn ]]$ first_look_initial_timestamp <- df $ timestamp [fi_pairs $ fistart [i ]]
470468 }
471469
472- # if this is the last fixation and since this if-block tracks if we are in an overflowing fixation
473- # we can set the ending reason to trialend and and make a forced_stop for the first_looks_collection
474- current_first_look_ending_reason [[hn ]] <- " trialend"
475- first_looks_collection [[hn ]]$ forced_stop <- TRUE
476- # overwrite current_first_look_duration[[hn]] to include saccades and error data and not only fixations
477- current_first_look_duration [[hn ]] <- end_ms - first_looks_collection [[hn ]]$ first_look_initial_timestamp
478-
479470 if (
480471 first_looks_collection [[hn ]]$ found_first && ! first_looks_collection [[hn ]]$ forced_stop &&
481472 (
@@ -489,6 +480,16 @@ get_looks <- function(df,
489480 # update current_first_looks_last_fi to next fi
490481 current_first_look_last_fi [[hn ]] <- i
491482
483+ # if this is the last fixation and since this if-block tracks if we are in an overflowing fixation
484+ # we can set the ending reason to trialend and and make a forced_stop for the first_looks_collection
485+ current_first_look_ending_reason [[hn ]] <- " trialend"
486+ first_looks_collection [[hn ]]$ forced_stop <- TRUE
487+ # overwrite current_first_look_duration[[hn]] to include saccades and error data and not only fixations
488+ current_first_look_duration [[hn ]] <- end_ms - first_looks_collection [[hn ]]$ first_look_initial_timestamp
489+ # moreover we can break this iteration, since the trial ended and outside and timecritertion is possible anymore
490+ break
491+
492+
492493 # check if outside label is between this fi and the next fi
493494 if (i < max(df $ fi , na.rm = TRUE ) && is_hitname_in_range(df [[column_name ]], outside_aoi_label , i , i + 1 )) {
494495 # outside fixation or saccade after last fi
0 commit comments