fix: limit transactions from analytics page to the last 2 months

This commit is contained in:
Sérgio Salgado 2022-01-17 23:22:30 +00:00
parent 556d8433fa
commit a21bb1cbd5
2 changed files with 18 additions and 4 deletions

View file

@ -2,7 +2,7 @@ var db = require('./db')
exports.up = function (next) {
var sql = [
`ALTER TABLE customers ADD COLUMN is_test_customer BOOLEAN DEFAULT false`,
`ALTER TABLE customers ADD COLUMN is_test_customer BOOLEAN NOT NULL DEFAULT false`,
]
db.multi(sql, next)

View file

@ -2,6 +2,8 @@ import { useQuery } from '@apollo/react-hooks'
import { Box } from '@material-ui/core'
import { makeStyles } from '@material-ui/core/styles'
import classnames from 'classnames'
import { endOfToday } from 'date-fns'
import { subDays } from 'date-fns/fp'
import gql from 'graphql-tag'
import * as R from 'ramda'
import React, { useState } from 'react'
@ -42,8 +44,16 @@ const TIME_OPTIONS = {
}
const GET_TRANSACTIONS = gql`
query transactions($excludeTestingCustomers: Boolean) {
transactions(excludeTestingCustomers: $excludeTestingCustomers) {
query transactions(
$from: Date
$until: Date
$excludeTestingCustomers: Boolean
) {
transactions(
from: $from
until: $until
excludeTestingCustomers: $excludeTestingCustomers
) {
id
txClass
txHash
@ -117,7 +127,11 @@ const Analytics = () => {
const classes = useStyles()
const { data: txResponse, loading: txLoading } = useQuery(GET_TRANSACTIONS, {
variables: { excludeTestingCustomers: true }
variables: {
from: subDays(65, endOfToday()),
until: endOfToday(),
excludeTestingCustomers: true
}
})
const { data: configResponse, loading: configLoading } = useQuery(GET_DATA)