You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should be a time-counting feature similar to what we're doing in Aqualab for TotalSessionTime (can ask @smitpatel8 for details/code to share, and/or check work on the feature/aqualab branch).
In particular:
In event filter, request "all_events", so that every event is seen by the feature
In the init function, accept an extra argument called threshold or something similar. We'll use this in the update function
Also set up counters for "active" and "idle" time. We'll add together to get total time.
You could also count total time and idle time, subtract to get active time, whatever is easiest. Just as long as we can get all 3 in the end.
In the update function, take the difference in time between the current event passed in, and the most recent event (so at end of this function, make sure to save current event timestamp as self.previous_timestamp or similar). Then:
If the difference in time is > self.threshold, it counts as idle time.
If the difference is < self.threshold, it counts as active time.
The difference always counts as total time.
In the Subfeatures function, we want to define the following subfeatures:
Seconds
Idle
IdleSeconds
Active
ActiveSeconds
In the calculate function, calculate and return: [total_time, total_seconds, idle_time, idle_seconds, active_time, active_seconds], where:
total_time is the total time as a stringified timedelta, and total_seconds is the result of calling total_time.total_seconds() function.
similar for the idle time
similar for the active time
The text was updated successfully, but these errors were encountered:
The current SessionDuration feature from Aqualab is a good reference for the general algorithm, though the code itself could be cleaner and make better use of local variables (e.g. not repeatedly calculating event.Timestamp - self.previous_time):
This should be a time-counting feature similar to what we're doing in Aqualab for
TotalSessionTime
(can ask @smitpatel8 for details/code to share, and/or check work on thefeature/aqualab
branch).In particular:
"all_events"
, so that every event is seen by the featurethreshold
or something similar. We'll use this in the update functionself.previous_timestamp
or similar). Then:> self.threshold
, it counts as idle time.< self.threshold
, it counts as active time.[total_time, total_seconds, idle_time, idle_seconds, active_time, active_seconds]
, where:total_time
is the total time as a stringifiedtimedelta
, andtotal_seconds
is the result of callingtotal_time.total_seconds()
function.The text was updated successfully, but these errors were encountered: