Skip to content

Commit

Permalink
Fix duplicate maps in relationship (librenms#16081)
Browse files Browse the repository at this point in the history
When a device is added to a map multiple times, it caused the map to show multiple times in the device overview.
  • Loading branch information
murrant authored May 31, 2024
1 parent c777d54 commit cf422b8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Models/Device.php
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,8 @@ public function macs(): HasMany

public function maps(): HasManyThrough
{
return $this->hasManyThrough(CustomMap::class, CustomMapNode::class, 'device_id', 'custom_map_id', 'device_id', 'custom_map_id');
return $this->hasManyThrough(CustomMap::class, CustomMapNode::class, 'device_id', 'custom_map_id', 'device_id', 'custom_map_id')
->distinct();
}

public function mefInfo(): HasMany
Expand Down

0 comments on commit cf422b8

Please sign in to comment.