mirror of
https://github.com/mempool/mempool.git
synced 2025-02-24 06:47:52 +01:00
fix mysql query
This commit is contained in:
parent
0dff902151
commit
ece40c5e74
1 changed files with 13 additions and 2 deletions
|
@ -70,15 +70,26 @@ class AccelerationRepository {
|
|||
JOIN pools on pools.unique_id = accelerations.pool
|
||||
`;
|
||||
let params: any[] = [];
|
||||
let hasFilter = false;
|
||||
|
||||
if (interval) {
|
||||
query += ` WHERE accelerations.added BETWEEN DATE_SUB(NOW(), INTERVAL ${interval}) AND NOW() `;
|
||||
hasFilter = true;
|
||||
}
|
||||
|
||||
if (height != null) {
|
||||
query += ` WHERE accelerations.height = ? `;
|
||||
if (hasFilter) {
|
||||
query += ` AND accelerations.height = ? `;
|
||||
} else {
|
||||
query += ` WHERE accelerations.height = ? `;
|
||||
}
|
||||
params.push(height);
|
||||
} else if (poolSlug != null) {
|
||||
query += ` WHERE pools.slug = ? `;
|
||||
if (hasFilter) {
|
||||
query += ` AND pools.slug = ? `;
|
||||
} else {
|
||||
query += ` WHERE pools.slug = ? `;
|
||||
}
|
||||
params.push(poolSlug);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue