Permalink
Browse files

Merge pull request #35 from brimstone/fix-round-stats-logging

Move support for saving round stats to a variable
  • Loading branch information...
2 parents 0d2aad9 + 1fa3d9d commit 2c145adda0ad6b2894aeb40b94c1d4b5bea8c173 @Abstrct committed on GitHub Dec 20, 2016
Showing with 6 additions and 3 deletions.
  1. +2 −1 schema/deploy/data-initial_settings.sql
  2. +4 −2 schema/deploy/function-round_control.sql
@@ -15,6 +15,7 @@ INSERT INTO variable VALUES
('MAX_SHIP_HEALTH','f',1000,'','This is the maximum health a ship can have'::TEXT,0),
('ROUND_START_DATE','f',0,'1986-03-27','The day the round started.'::TEXT,0),
('ROUND_LENGTH','f',0,'1 days','The length of time a round takes to complete'::TEXT,0),
- ('DEFENSE_EFFICIENCY', 'f', 50, '', 'Used to calculate attack with defense'::TEXT,0);
+ ('DEFENSE_EFFICIENCY', 'f', 50, '', 'Used to calculate attack with defense'::TEXT,0),
+ ('ROUND_STATS_PREFIX', 'f', 0, '', 'Prefix to be use for round status'::TEXT,0);
COMMIT;
@@ -79,8 +79,10 @@ BEGIN
update fleet set runtime='0 minutes', enabled='f';
--add archives of stats and events
- CREATE TEMP TABLE tmp_current_round_archive AS SELECT (SELECT last_value FROM round_seq), event.* FROM event;
- EXECUTE 'COPY tmp_current_round_archive TO ''/hell/schemaverse_round_' || (SELECT last_value FROM round_seq) || '.csv'' WITH DELIMITER ''|''';
+ IF GET_CHAR_VARIABLE('ROUND_STATS_PREFIX') != '' THEN
+ CREATE TEMP TABLE tmp_current_round_archive AS SELECT (SELECT last_value FROM round_seq), event.* FROM event;
+ EXECUTE 'COPY tmp_current_round_archive TO ''' || GET_CHAR_VARIABLE('ROUND_STATS_PREFIX') || (SELECT last_value FROM round_seq) || '.csv'' WITH DELIMITER ''|''';
+ END IF;
--Delete everything else
DELETE FROM planet_miners;

0 comments on commit 2c145ad

Please sign in to comment.