fix: limit transactions from analytics page to the last 2 months
This commit is contained in:
parent
556d8433fa
commit
a21bb1cbd5
2 changed files with 18 additions and 4 deletions
|
|
@ -2,7 +2,7 @@ var db = require('./db')
|
||||||
|
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
var sql = [
|
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)
|
db.multi(sql, next)
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ import { useQuery } from '@apollo/react-hooks'
|
||||||
import { Box } from '@material-ui/core'
|
import { Box } from '@material-ui/core'
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
import { endOfToday } from 'date-fns'
|
||||||
|
import { subDays } from 'date-fns/fp'
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
import * as R from 'ramda'
|
import * as R from 'ramda'
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
|
|
@ -42,8 +44,16 @@ const TIME_OPTIONS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const GET_TRANSACTIONS = gql`
|
const GET_TRANSACTIONS = gql`
|
||||||
query transactions($excludeTestingCustomers: Boolean) {
|
query transactions(
|
||||||
transactions(excludeTestingCustomers: $excludeTestingCustomers) {
|
$from: Date
|
||||||
|
$until: Date
|
||||||
|
$excludeTestingCustomers: Boolean
|
||||||
|
) {
|
||||||
|
transactions(
|
||||||
|
from: $from
|
||||||
|
until: $until
|
||||||
|
excludeTestingCustomers: $excludeTestingCustomers
|
||||||
|
) {
|
||||||
id
|
id
|
||||||
txClass
|
txClass
|
||||||
txHash
|
txHash
|
||||||
|
|
@ -117,7 +127,11 @@ const Analytics = () => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|
||||||
const { data: txResponse, loading: txLoading } = useQuery(GET_TRANSACTIONS, {
|
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)
|
const { data: configResponse, loading: configLoading } = useQuery(GET_DATA)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue