Fix some queries in postgres store

This commit is contained in:
Torjus Håkestad 2021-04-10 12:07:11 +02:00
parent 0fb2871ba1
commit a5b344277c

View File

@ -90,13 +90,13 @@ func (s *PostgresStore) Stats(statType LoginStats, limit int) ([]StatsResult, er
switch statType {
case LoginStatsCountry:
stmt = `select country, count(country) from login_attempts order by count desc`
stmt = `select country, count(country) from login_attempts group by country order by count desc`
case LoginStatsIP:
stmt = `select remote_ip, count(remote_ip) from login_attempts order by count desc`
stmt = `select remote_ip, count(remote_ip) from login_attempts group by remote_ip order by count desc`
case LoginStatsPasswords:
stmt = `select password, count(password) from login_attempts order by count desc`
stmt = `select password, count(password) from login_attempts group by password order by count desc`
case LoginStatsUsername:
stmt = `select username, count(username) from login_attempts order by count desc`
stmt = `select username, count(username) from login_attempts group by username order by count desc`
}
if limit > 0 {