Skip to content

Commit 62ebc62

Browse files
committed
fix(server): Fixed getting one day's worth of data after changing the database date from date to timstamp
1 parent bf2fde8 commit 62ebc62

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

server/routes/getRate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = async function getRateRoute(fastify) {
1818
query['from_currency'],
1919
query['conv_currency'],
2020
query['date'],
21-
query['conv_amount'] ? query['conv_amount'] : 0
21+
query['conv_amount'] ? query['conv_amount'] : 0,
2222
);
2323
else if (query['start_date'] && query['end_date'])
2424
rate_res = await rate.getPeriod(

shared/database/src/main.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ async function getDay(from_currency, conv_currency, date, conv_amount) {
88

99
const data = await pool.query(
1010
'SELECT from_currency, conv_currency, date, rate FROM currency ' +
11-
'WHERE from_currency = $1 AND conv_currency = $2 AND date = $3',
11+
'WHERE from_currency = $1 AND conv_currency = $2 AND date::date = $3::date',
1212
[from_currency.toUpperCase(), conv_currency.toUpperCase(), date],
1313
);
1414

15-
1615
if (data?.['rows'].length <= 0) return 'Missing data';
1716

1817
if (conv_amount) {

0 commit comments

Comments
 (0)