Skip to content

Commit d17d6ff

Browse files
moons/feature: use sell value for better price accuracy (#714)
1 parent 200da6d commit d17d6ff

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Http/DataTables/Tools/MoonsDataTable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ public function query()
116116
'moon.solar_system.sovereignty.alliance', 'moon.solar_system.sovereignty.corporation', 'content')
117117
->select()
118118
//this is not an SQL injection since $mining_volume is a constant int on a class
119-
->selectRaw('(SELECT SUM(rate * ? * ?/invTypes.volume*market_prices.adjusted_price) FROM universe_moon_contents JOIN invTypes ON invTypes.typeID=universe_moon_contents.type_id JOIN market_prices ON market_prices.type_id=universe_moon_contents.type_id WHERE moon_id=universe_moon_reports.moon_id) as raw_value', [$mining_volume, $hours_per_month])
120-
->selectRaw('(select SUM((select SUM(invTypeMaterials.quantity*market_prices.adjusted_price) from invTypeMaterials join market_prices on market_prices.type_id=invTypeMaterials.materialTypeID where invTypeMaterials.typeID=universe_moon_contents.type_id) * universe_moon_contents.rate * ? * ? / invTypes.volume * ? / 100) from universe_moon_contents join invTypes on invTypes.typeID=universe_moon_contents.type_id where universe_moon_contents.moon_id=universe_moon_reports.moon_id) as refined_value', [$mining_volume, $hours_per_month, $reprocessing_yield]);
119+
->selectRaw('(SELECT SUM(rate * ? * ?/invTypes.volume*market_prices.sell_price) FROM universe_moon_contents JOIN invTypes ON invTypes.typeID=universe_moon_contents.type_id JOIN market_prices ON market_prices.type_id=universe_moon_contents.type_id WHERE moon_id=universe_moon_reports.moon_id) as raw_value', [$mining_volume, $hours_per_month])
120+
->selectRaw('(select SUM((select SUM(invTypeMaterials.quantity*market_prices.sell_price) from invTypeMaterials join market_prices on market_prices.type_id=invTypeMaterials.materialTypeID where invTypeMaterials.typeID=universe_moon_contents.type_id) * universe_moon_contents.rate * ? * ? / invTypes.volume * ? / 100) from universe_moon_contents join invTypes on invTypes.typeID=universe_moon_contents.type_id where universe_moon_contents.moon_id=universe_moon_reports.moon_id) as refined_value', [$mining_volume, $hours_per_month, $reprocessing_yield]);
121121
}
122122

123123
/**

src/resources/views/tools/moons/modals/components/content.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<td>{{ number_format($type->pivot->rate * 100, 2) }} %</td>
5959
<td>{{ number_format($type->pivot->rate * Seat\Eveapi\Models\Industry\CorporationIndustryMiningExtraction::BASE_DRILLING_VOLUME * 720, 2) }} m3</td>
6060
<td>{{ number_format(($type->pivot->rate * Seat\Eveapi\Models\Industry\CorporationIndustryMiningExtraction::BASE_DRILLING_VOLUME * 720) / $type->volume) }}</td>
61-
<td>{{ number_format((($type->pivot->rate * Seat\Eveapi\Models\Industry\CorporationIndustryMiningExtraction::BASE_DRILLING_VOLUME * 720) / $type->volume) * $type->price->adjusted_price, 2) }}</td>
61+
<td>{{ number_format((($type->pivot->rate * Seat\Eveapi\Models\Industry\CorporationIndustryMiningExtraction::BASE_DRILLING_VOLUME * 720) / $type->volume) * $type->price->sell_price, 2) }}</td>
6262
</tr>
6363
@endforeach
6464
<tfoot>
@@ -99,7 +99,7 @@
9999
</td>
100100
<td>{{ number_format($material->sum('pivot.quantity') * $material->first()->volume, 2) }} m3</td>
101101
<td>{{ number_format($material->sum('pivot.quantity')) }}</td>
102-
<td>{{ number_format($material->sum('pivot.quantity') * $material->first()->price->adjusted_price) }}</td>
102+
<td>{{ number_format($material->sum('pivot.quantity') * $material->first()->price->sell_price) }}</td>
103103
</tr>
104104
@endforeach
105105
<tfoot>

0 commit comments

Comments
 (0)