Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Commit 476972e

Browse files
committed
change overwrite_with_dev_data behaviour
1 parent fabf6e9 commit 476972e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/phpFITFileAnalysis.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,10 +1116,9 @@ public function __construct($file_path, $options = null)
11161116
if (isset($options['garmin_timestamps']) && $options['garmin_timestamps'] == true) {
11171117
$this->garmin_timestamps = true;
11181118
}
1119-
if (!isset($this->options['overwrite_with_dev_data']) || $this->options['overwrite_with_dev_data'] == true) {
1119+
$this->options['overwrite_with_dev_data'] = false;
1120+
if (isset($this->options['overwrite_with_dev_data']) && $this->options['overwrite_with_dev_data'] == true) {
11201121
$this->options['overwrite_with_dev_data'] = true;
1121-
} else {
1122-
$this->options['overwrite_with_dev_data'] = false;
11231122
}
11241123
$this->php_trader_ext_loaded = extension_loaded('trader');
11251124

@@ -1398,10 +1397,13 @@ private function readDataRecords()
13981397
}
13991398
}
14001399
// Overwrite native FIT fields (e.g. Power, HR, Cadence, etc) with developer data by default
1401-
if ($this->options['overwrite_with_dev_data'] && !empty($this->dev_field_descriptions)) {
1400+
if (!empty($this->dev_field_descriptions)) {
14021401
foreach ($this->dev_field_descriptions as $developer_data_index) {
14031402
foreach ($developer_data_index as $field_definition_number) {
14041403
if (isset($field_definition_number['native_field_num'])) {
1404+
if (isset($this->data_mesgs['record'][$field_definition_number['field_name']]) && !$this->options['overwrite_with_dev_data']) {
1405+
continue;
1406+
}
14051407
$this->data_mesgs['record'][$field_definition_number['field_name']] = $this->data_mesgs['developer_data'][$field_definition_number['field_name']]['data'];
14061408
}
14071409
}

0 commit comments

Comments
 (0)