Research-IT-Swiss-TPH / redcap-device-tracker

Device Tracker is a REDCap External Module to cover the case for cross-project multi-device tracking.
https://research-it-swiss-tph.github.io/redcap-device-tracker/
MIT License
0 stars 0 forks source link

Fix support for multiple events: Pass event ID when getting current tracking id #9

Closed tertek closed 9 months ago

tertek commented 9 months ago

Currently multiple event are not fully supported. Whenever a tracking will be assigned on the same record for different events, an error: "Invalid current tracking ID .. " will be thrown.

Therefore, Device Tracker is required to differentiate between different events.

https://github.com/Research-IT-Swiss-TPH/redcap-device-tracker/blob/b70003cf0894eace7683df676e5e00648a6d2f3f/deviceTracker.php#L634

Possible Fix;

pass event id to getCurrentTrackingID

private function getCurrentTrackingId($pid, $field, $id) {
    $result = $this->query(
                "SELECT value FROM redcap_data WHERE project_id = ? AND field_name = ? AND record = ?", 
                [ $pid, $field, $id ]
            );
    return $result->fetch_object()->value;
}    
tertek commented 9 months ago

EEDD4385-B514-4A54-9C4D-BD78DD20470E

tertek commented 9 months ago

Also check why we cannot add a same tracker for different trackings. Assign works, but not Return or Reset.

tertek commented 9 months ago

add event to tracking context