Refactor SQL query for candidate selection: Updated the SQL query to include a new FROM candidates clause, ensuring accurate retrieval of the top production candidates based on worth calculations. This change enhances the clarity and functionality of the production selection process.
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 1m54s
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 1m54s
This commit is contained in:
@@ -301,6 +301,7 @@ SELECT
|
||||
ROUND(((sell_cost::float8 * market_percent_val / 100.0 * (0.6 + 0.4 * (LEAST(100.0, GREATEST(0.0, (2.0 * knowledge_char_val + knowledge_dir_val) / 3.0)) / 100.0))) - (GREATEST((sell_cost::float8 * market_percent_val / 100.0 * (0.6 + 0.4 * (LEAST(100.0, GREATEST(0.0, (2.0 * knowledge_char_val + knowledge_dir_val) / 3.0)) / 100.0)) - one_piece_cost_val), 0.0) * (COALESCE($3::float8, 0.0) / 100.0)) - one_piece_cost_val)::numeric, 4)::text AS net_piece,
|
||||
ROUND(COALESCE($3::numeric, 0), 2)::text AS tax_percent,
|
||||
ROUND((((sell_cost::float8 * market_percent_val / 100.0 * (0.6 + 0.4 * (LEAST(100.0, GREATEST(0.0, (2.0 * knowledge_char_val + knowledge_dir_val) / 3.0)) / 100.0))) - (GREATEST((sell_cost::float8 * market_percent_val / 100.0 * (0.6 + 0.4 * (LEAST(100.0, GREATEST(0.0, (2.0 * knowledge_char_val + knowledge_dir_val) / 3.0)) / 100.0)) - one_piece_cost_val), 0.0) * (COALESCE($3::float8, 0.0) / 100.0)) - one_piece_cost_val) / NULLIF(production_time::float8, 0.0))::numeric, 8)::text AS worth
|
||||
FROM candidates
|
||||
ORDER BY worth DESC
|
||||
LIMIT 5;
|
||||
"#;
|
||||
|
||||
Reference in New Issue
Block a user