Refactor SQL queries for type consistency: Updated various SQL queries to ensure consistent data types by casting results to text. This change enhances compatibility and improves the handling of JSON data in the application.
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 1m37s
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 1m37s
This commit is contained in:
@@ -163,11 +163,11 @@ WHERE fdd.id = $1 AND fdb.id = $2 ORDER BY worth DESC LIMIT 1;
|
||||
/// Liefert die Top-5 Kandidaten inkl. Teilmetriken, die in `worth` einfließen.
|
||||
pub const QUERY_GET_BEST_PRODUCTION_DEBUG: &str = r#"
|
||||
SELECT
|
||||
ftp.id AS product_id,
|
||||
ftp.id::text AS product_id,
|
||||
ftp.label_tr,
|
||||
COALESCE(ftp.category, 1)::int AS product_category,
|
||||
COALESCE(ftp.production_time, 0)::int AS production_time,
|
||||
ROUND(ftp.sell_cost::numeric, 2) AS sell_cost,
|
||||
COALESCE(ftp.category, 1)::int::text AS product_category,
|
||||
COALESCE(ftp.production_time, 0)::int::text AS production_time,
|
||||
ROUND(ftp.sell_cost::numeric, 2)::text AS sell_cost,
|
||||
ROUND(
|
||||
(
|
||||
CASE
|
||||
@@ -180,9 +180,9 @@ SELECT
|
||||
END
|
||||
)::numeric,
|
||||
2
|
||||
) AS market_percent,
|
||||
COALESCE(fdk_character.knowledge, 0)::int AS knowledge_character,
|
||||
COALESCE(fdk_director.knowledge, 0)::int AS knowledge_director,
|
||||
)::text AS market_percent,
|
||||
COALESCE(fdk_character.knowledge, 0)::int::text AS knowledge_character,
|
||||
COALESCE(fdk_director.knowledge, 0)::int::text AS knowledge_director,
|
||||
ROUND(
|
||||
(
|
||||
(
|
||||
@@ -198,7 +198,7 @@ SELECT
|
||||
+ (2.0 * COALESCE(fdk_character.knowledge, 0)::float8 + COALESCE(fdk_director.knowledge, 0)::float8) / 3.0
|
||||
)::numeric,
|
||||
2
|
||||
) AS effective_percent,
|
||||
)::text AS effective_percent,
|
||||
ROUND(
|
||||
(
|
||||
(
|
||||
@@ -215,7 +215,7 @@ SELECT
|
||||
)
|
||||
)::numeric,
|
||||
4
|
||||
) AS one_piece_cost,
|
||||
)::text AS one_piece_cost,
|
||||
ROUND(
|
||||
(
|
||||
ftp.sell_cost
|
||||
@@ -234,7 +234,7 @@ SELECT
|
||||
) / 100.0
|
||||
)::numeric,
|
||||
4
|
||||
) AS revenue_piece,
|
||||
)::text AS revenue_piece,
|
||||
ROUND(
|
||||
(
|
||||
(
|
||||
@@ -269,7 +269,7 @@ SELECT
|
||||
) / (300.0 * NULLIF(ftp.production_time::float8, 0.0))
|
||||
)::numeric,
|
||||
8
|
||||
) AS worth
|
||||
)::text AS worth
|
||||
FROM falukant_data.director fdd
|
||||
JOIN falukant_data.character fdc ON fdc.id = fdd.director_character_id
|
||||
JOIN falukant_data.falukant_user fdu ON fdd.employer_user_id = fdu.id
|
||||
@@ -3504,9 +3504,9 @@ pub const QUERY_GET_ACTIVE_LOVER_ROWS_FOR_DAILY: &str = r#"
|
||||
rs.maintenance_level,
|
||||
rs.status_fit,
|
||||
rs.monthly_base_cost,
|
||||
rs.scandal_extra_daily_pct,
|
||||
COALESCE((to_jsonb(rs)->>'scandal_extra_daily_pct')::int, 0) AS scandal_extra_daily_pct,
|
||||
rs.months_underfunded,
|
||||
COALESCE(rs.acknowledged, false) AS acknowledged,
|
||||
COALESCE((to_jsonb(rs)->>'acknowledged')::boolean, false) AS acknowledged,
|
||||
c1.gender AS g1,
|
||||
c2.gender AS g2,
|
||||
COALESCE(t1.tr, '') AS title1_tr,
|
||||
@@ -3558,7 +3558,7 @@ pub const QUERY_GET_ACTIVE_LOVER_ROWS_FOR_MONTHLY: &str = r#"
|
||||
rs.maintenance_level,
|
||||
rs.status_fit,
|
||||
rs.monthly_base_cost,
|
||||
rs.scandal_extra_daily_pct,
|
||||
COALESCE((to_jsonb(rs)->>'scandal_extra_daily_pct')::int, 0) AS scandal_extra_daily_pct,
|
||||
rs.months_underfunded,
|
||||
c1.gender AS g1,
|
||||
c2.gender AS g2,
|
||||
@@ -3601,8 +3601,7 @@ pub const QUERY_UPDATE_LOVER_UNDERPAY_STATE: &str = r#"
|
||||
SET affection = $1::smallint,
|
||||
discretion = $2::smallint,
|
||||
visibility = $3::smallint,
|
||||
months_underfunded = $4::smallint,
|
||||
scandal_extra_daily_pct = $5::smallint
|
||||
months_underfunded = $4::smallint
|
||||
WHERE relationship_id = $6::int;
|
||||
"#;
|
||||
|
||||
@@ -3761,7 +3760,7 @@ pub const QUERY_GET_ACTIVE_LOVER_ROWS_FOR_INSTALLMENT: &str = r#"
|
||||
rs.maintenance_level,
|
||||
rs.status_fit,
|
||||
rs.monthly_base_cost,
|
||||
rs.scandal_extra_daily_pct,
|
||||
COALESCE((to_jsonb(rs)->>'scandal_extra_daily_pct')::int, 0) AS scandal_extra_daily_pct,
|
||||
rs.months_underfunded,
|
||||
c1.gender AS g1,
|
||||
c2.gender AS g2,
|
||||
|
||||
Reference in New Issue
Block a user