Skip to content

Commit

Permalink
Merge pull request #1286 from seatplus/fix/metric-prefix
Browse files Browse the repository at this point in the history
Fix/metric prefix
  • Loading branch information
herpaderpaldent authored Sep 30, 2022
2 parents 7908bd4 + bab351c commit fcef3ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 2 additions & 3 deletions resources/js/Pages/Character/ItemDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import EveImage from "@/Shared/EveImage.vue"
import PageHeader from "@/Shared/Layout/PageHeader.vue";
import ItemLayout from "@/Shared/Components/ItemLayout.vue";
import { prefix } from "metric-prefix";
export default {
name: "ItemDetails",
Expand Down Expand Up @@ -59,13 +60,11 @@ export default {
methods: {
getMetricPrefix(numeric_value) {
const {prefix} = require('metric-prefix')
return prefix(numeric_value, {precision: 3, unit: ''})
},
url(asset) {
return _.isEmpty(asset.content) ? '#' : route('character.item', asset.item_id)
return _.isEmpty(asset.content) ? '' : route('character.item', {'item_id': asset.item_id, 'character_id': asset.owner.character_id})
},
hasContent(content) {
return !_.isEmpty(content)
Expand Down
5 changes: 2 additions & 3 deletions resources/js/Shared/Components/LocationSlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ import WideLists from "../WideLists.vue";
import WideListElement from "../WideListElement.vue";
import EveImage from "../EveImage.vue"
import CardWithHeader from "@/Shared/Layout/Cards/CardWithHeader.vue";
import { prefix } from "metric-prefix";
export default {
name: "LocationSlot",
Expand Down Expand Up @@ -124,13 +125,11 @@ export default {
methods: {
getMetricPrefix(numeric_value) {
const {prefix} = require('metric-prefix')
return prefix(numeric_value, {precision: 3, unit: ''})
},
url(asset) {
return _.isEmpty(asset.content) ? '' : route('character.item', asset.item_id)
return _.isEmpty(asset.content) ? '' : route('character.item', {'item_id': asset.item_id, 'character_id': asset.owner.character_id})
},
hasContent(content) {
return !_.isEmpty(content)
Expand Down
5 changes: 4 additions & 1 deletion src/Http/Controllers/Character/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ public function loadLocation(int $location_id, Request $request)

public function item(int $character_id, int $item_id)
{
$query = EveApiAsset::with(['location', 'type', 'type.group', 'container', 'content', 'content.content', 'content.type', 'content.type.group'])
$query = EveApiAsset::with([
'location', 'type', 'type.group', 'container',
'content' => ['content', 'type', 'type.group', 'assetable'],
])
->where('assetable_id', $character_id)
->where('assetable_type', CharacterInfo::class)
->where('item_id', $item_id);
Expand Down

0 comments on commit fcef3ed

Please sign in to comment.