Update production worth calculation in SQL and documentation: Refined the worth formula to focus on regional revenue per time unit, removing knowledge factors and old cost penalties. Enhanced documentation to clarify the new sorting criteria and its implications for production management.
This commit is contained in:
@@ -78,7 +78,10 @@ SELECT fdu.id falukant_user_id, CAST(fdu.money AS text) AS money, fdu.certificat
|
||||
COALESCE(ftp.category, 1)::int AS product_category, fdb.region_id,
|
||||
(SELECT SUM(quantity) FROM falukant_data.stock fds WHERE fds.branch_id = fdb.id) AS stock_size,
|
||||
COALESCE((SELECT SUM(COALESCE(fdi.quantity, 0)) FROM falukant_data.stock fds JOIN falukant_data.inventory fdi ON fdi.stock_id = fds.id WHERE fds.branch_id = fdb.id), 0) AS used_in_stock,
|
||||
(ftp.sell_cost * (fdtpw.worth_percent + (fdk_character.knowledge * 2 + fdk_director.knowledge) / 3) / 100 - 6 * ftp.category) / (300.0 * ftp.production_time) AS worth,
|
||||
-- Ranking = regionaler Erlös pro Zeiteinheit (wie „Erlös/Minute“ in der Oberfläche):
|
||||
-- Listenpreis * regionaler Marktanteil / Produktionsdauer — ohne Wissens-Additiv und ohne alte Kostenstrafe
|
||||
-- im Zähler (die echte Stückkosten berechnet der Director in Rust).
|
||||
( (ftp.sell_cost * (fdtpw.worth_percent / 100.0)) / NULLIF(ftp.production_time::float8, 0.0) ) AS worth,
|
||||
fdb.id AS branch_id, (SELECT COUNT(id) FROM falukant_data.production WHERE branch_id = fdb.id) AS running_productions,
|
||||
COALESCE((SELECT SUM(COALESCE(fdp.quantity, 0)) quantity FROM falukant_data.production fdp WHERE fdp.branch_id = fdb.id), 0) AS running_productions_quantity
|
||||
FROM falukant_data.director fdd
|
||||
|
||||
Reference in New Issue
Block a user