Fixed issue with services list. #1181

Merged
merged 1 commit into from Jun 2, 2015

Projects

None yet

2 participants

@SaaldjorMike
Member

Only unshift first time, since the sql_param array would contain all device_id's if we unshift every time.

@laf
Member
laf commented Jun 2, 2015

Thankts @SaaldjorMike What does this actually fix?

@SaaldjorMike
Member

@laf: Up until now it has been looping over all devices and fetching all rows in the services table for each device_id, but when there are multiple devices this would give:
Iteration 1: $sql_param = [device_id1, int, str]
Iteration 2: $sql_param = [device_id2, device_id1, int, str]
....

Since we use the array $sql_param when performing the query, we have not the correct value for service_status since $sql_param[1] now contains some other $device_id instead of the integer which is set on line 26.

Hope this clarifies it a bit.

@laf laf removed the Needs-Info label Jun 2, 2015
@laf laf merged commit e270db1 into librenms:master Jun 2, 2015

1 check passed

Scrutinizer No new issues
Details
@SaaldjorMike SaaldjorMike deleted the SaaldjorMike:fix-services-list-with-state branch Jan 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment