updated max interval to 3 days
This commit is contained in:
parent
655504a113
commit
de6228f985
@ -27,7 +27,8 @@ func (config *Config) GetConfig() (err error) {
|
|||||||
DbUsername: "username",
|
DbUsername: "username",
|
||||||
DbPassword: "password",
|
DbPassword: "password",
|
||||||
DbTable: "corona",
|
DbTable: "corona",
|
||||||
CoronaURL: "https://coronavirus.politologue.com/data/coronavirus/coronacsv.aspx?format=json"}
|
CoronaURL: "https://coronavirus.politologue.com/data/coronavirus/coronacsv.aspx?format=json",
|
||||||
|
}
|
||||||
|
|
||||||
err = cfg.Section("coronafana").MapTo(config)
|
err = cfg.Section("coronafana").MapTo(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -47,7 +48,8 @@ func (config *Config) GetConfig() (err error) {
|
|||||||
tauxinfection float(10) DEFAULT NULL,
|
tauxinfection float(10) DEFAULT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE KEY date (date) USING BTREE
|
UNIQUE KEY date (date) USING BTREE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
)
|
||||||
|
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
`
|
`
|
||||||
|
|
||||||
config.DbInsertGlobal = `
|
config.DbInsertGlobal = `
|
||||||
@ -56,7 +58,10 @@ func (config *Config) GetConfig() (err error) {
|
|||||||
ON DUPLICATE KEY UPDATE date=:date,infection=:infection, deces=:deces, guerisons=:guerisons, tauxdeces=:tauxdeces, tauxguerison=:tauxguerison, tauxinfection=:tauxinfection;
|
ON DUPLICATE KEY UPDATE date=:date,infection=:infection, deces=:deces, guerisons=:guerisons, tauxdeces=:tauxdeces, tauxguerison=:tauxguerison, tauxinfection=:tauxinfection;
|
||||||
`
|
`
|
||||||
|
|
||||||
config.DbMaxDateGlobal = `SELECT IFNULL(SUBDATE(MAX(date), INTERVAL 1 DAY), "0001-01-01 00:00:00") FROM coronaglobaldata;`
|
config.DbMaxDateGlobal = `
|
||||||
|
SELECT IFNULL(SUBDATE(MAX(date), INTERVAL 3 DAY), "0001-01-01 00:00:00")
|
||||||
|
FROM coronaglobaldata;
|
||||||
|
`
|
||||||
|
|
||||||
config.DbSchemaPays = `
|
config.DbSchemaPays = `
|
||||||
CREATE TABLE IF NOT EXISTS coronapaysdata
|
CREATE TABLE IF NOT EXISTS coronapaysdata
|
||||||
@ -72,14 +77,20 @@ func (config *Config) GetConfig() (err error) {
|
|||||||
tauxinfection float(10) DEFAULT NULL,
|
tauxinfection float(10) DEFAULT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE KEY date (date,pays) USING BTREE
|
UNIQUE KEY date (date,pays) USING BTREE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;`
|
)
|
||||||
|
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
`
|
||||||
|
|
||||||
config.DbInsertPays = `
|
config.DbInsertPays = `
|
||||||
INSERT INTO coronapaysdata (date, pays, infection, deces, guerisons, tauxdeces, tauxguerison, tauxinfection)
|
INSERT INTO coronapaysdata (date, pays, infection, deces, guerisons, tauxdeces, tauxguerison, tauxinfection)
|
||||||
VALUES (:date, :pays, :infection, :deces, :guerisons, :tauxdeces, :tauxguerison, :tauxinfection)
|
VALUES (:date, :pays, :infection, :deces, :guerisons, :tauxdeces, :tauxguerison, :tauxinfection)
|
||||||
ON DUPLICATE KEY UPDATE date=:date, pays=:pays,infection=:infection, deces=:deces, guerisons=:guerisons, tauxdeces=:tauxdeces, tauxguerison=:tauxguerison, tauxinfection=:tauxinfection;`
|
ON DUPLICATE KEY UPDATE date=:date, pays=:pays,infection=:infection, deces=:deces, guerisons=:guerisons, tauxdeces=:tauxdeces, tauxguerison=:tauxguerison, tauxinfection=:tauxinfection;
|
||||||
|
`
|
||||||
|
|
||||||
config.DbMaxDatePays = `SELECT IFNULL(SUBDATE(MAX(date), INTERVAL 1 DAY), "0001-01-01 00:00:00") FROM coronapaysdata;`
|
config.DbMaxDatePays = `
|
||||||
|
SELECT IFNULL(SUBDATE(MAX(date), INTERVAL 3 DAY), "0001-01-01 00:00:00")
|
||||||
|
FROM coronapaysdata;
|
||||||
|
`
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user