mirror of
https://github.com/amineo/t2-stat-parser.git
synced 2026-01-19 17:34:43 +00:00
Cast string to interval correctly
This commit is contained in:
parent
edd3076b54
commit
3114913c85
|
|
@ -103,7 +103,7 @@ export class PlayersService {
|
||||||
// Cast to float to avoid integer division truncating the result.
|
// Cast to float to avoid integer division truncating the result.
|
||||||
const aggregatedAccuracy = `(${aggregatedHits}::float / ${aggregatedShots}::float)`;
|
const aggregatedAccuracy = `(${aggregatedHits}::float / ${aggregatedShots}::float)`;
|
||||||
|
|
||||||
const sinceDate = '(now() - interval :timePeriod)';
|
const sinceDate = '(now() - (:timePeriod)::interval)';
|
||||||
|
|
||||||
// TODO: This whole query could probably be turned into a `ViewEntity` at
|
// TODO: This whole query could probably be turned into a `ViewEntity` at
|
||||||
// some point, but I couldn't get that to work.
|
// some point, but I couldn't get that to work.
|
||||||
|
|
@ -208,7 +208,7 @@ export class PlayersService {
|
||||||
async findTopWins(topWinsQuery: TopWinsQueryDto) {
|
async findTopWins(topWinsQuery: TopWinsQueryDto) {
|
||||||
const { minGames, limit, timePeriod } = topWinsQuery;
|
const { minGames, limit, timePeriod } = topWinsQuery;
|
||||||
|
|
||||||
const sinceDate = '(now() - interval :timePeriod)';
|
const sinceDate = '(now() - (:timePeriod)::interval)';
|
||||||
|
|
||||||
const query = this.playersRepository
|
const query = this.playersRepository
|
||||||
.createQueryBuilder('player')
|
.createQueryBuilder('player')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue