Emmanuel BENOîT
bf6bea5a79
* The quantities of resources extracted from mines will now be updated as soon as they have a reason to. This includes planet assignment, abandonment, ownership changes, and updates to mining priorities. * The mining update will now remove the current resource income from the providers, and only then re-compute all extracted quantities. This is more logical and corresponds to the way the other game updates work. * Fixed bug in extraction computation where the size of the planet's happy population was used instead of the happy/total ratio when adjusting the mining production for riots. * The following SQL scripts must be re-executed to upgrade a database: -> 040-functions/040-empire.sql -> 040-functions/145-resource-providers.sql -> 040-functions/147-empire-mining.sql -> 050-updates/120-planet-mining.sql
35 lines
No EOL
872 B
PL/PgSQL
35 lines
No EOL
872 B
PL/PgSQL
/*
|
|
* Test emp.total_mining_weights_view
|
|
*/
|
|
BEGIN;
|
|
/* Create a table which will server as an alternate source for
|
|
* emp.scaled_mining_weights_view ; the table is not temporary (PostgreSQL
|
|
* won't allow replacing the view otherwise), but will be dropped
|
|
* on rollback anyway.
|
|
*/
|
|
CREATE TABLE fake_mining_weights(
|
|
planet_id INT ,
|
|
resource_name_id INT ,
|
|
pmc_weight DOUBLE PRECISION
|
|
);
|
|
|
|
CREATE OR REPLACE VIEW emp.scaled_mining_weights_view
|
|
AS SELECT * FROM fake_mining_weights;
|
|
|
|
/* Insert fake records for two different planets */
|
|
INSERT INTO fake_mining_weights VALUES
|
|
( 1 , 0 , 1 ) ,
|
|
( 1 , 1 , 2 ) ,
|
|
( 2 , 0 , 4 ) ,
|
|
( 2 , 1 , 5 );
|
|
|
|
/***** TESTS BEGIN HERE *****/
|
|
SELECT plan( 1 );
|
|
|
|
SELECT set_eq(
|
|
$$ SELECT * FROM emp.total_mining_weights_view $$ ,
|
|
$$ VALUES ( 1 , 3.0 ) , ( 2 , 9.0 ) $$
|
|
);
|
|
|
|
SELECT * FROM finish( );
|
|
ROLLBACK; |