Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions resources/views/hardware/bulk-delete.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@
<td>{{ $asset->id }}</td>
<td>{{ $asset->present()->name() }}</td>
<td>
@if ($asset->location)
@if ($asset->location_id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this line changed? There is a relationship ($asset->location) which is being checked for, which is generally better than just checking for the ID, since the ID could be invalid.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, the two things we were checking against are the location_id and the rtd_location_id. these are the two values in the assets table when we looked for location. currently, we are ending up with blanks for the location of an asset on the bulk delete page, this is weird behavior, since it won't match the assets index page. since through deployedLocationFormatter we return the row.name off the row.id, and if not, then we pull the rtd_location.name from the rtd_location.id. its this if/else that we tried to parity.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but if the location_id or rtd_location_id reference a non-existent location (bad data, etc), that will 500. We should be checking against the relations to make sure those locations actually exist in the database.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

righto, i'll get to this on monday and get that switched over. ty for the explaination.

{{ $asset->location->name }}
@elseif($asset->rtd_location_id)
{{ $asset->defaultLoc->name }}
@endif
</td>
<td>

{{ $asset->assigned_to }}
@if ($asset->assignedTo)
{{ $asset->assignedTo->present()->name()}}
@if ($asset->assigned_to)
{{ $asset->assigned->present()->name() }}
@endif
</td>
</tr>
Expand Down
Loading