Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log add time condition 30 day #17

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from config import Cfg
from db_provider import get_history_token_price

service_version = "20220622.01"
service_version = "20220630.01"
Welcome = 'Welcome to ref datacenter API server, version '+service_version+', indexer %s' % Cfg.NETWORK[Cfg.NETWORK_ID]["INDEXER_HOST"][-3:]
# Instantiation, which can be regarded as fixed format
app = Flask(__name__)
Expand Down
8 changes: 6 additions & 2 deletions indexer_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from config import Cfg
import psycopg2
import decimal
import time

class DecimalEncoder(json.JSONEncoder):
def default(self, o):
Expand Down Expand Up @@ -50,7 +51,10 @@ def get_actions(network_id, account_id):
password=Cfg.NETWORK[network_id]["INDEXER_PWD"],
host=Cfg.NETWORK[network_id]["INDEXER_HOST"],
port=Cfg.NETWORK[network_id]["INDEXER_PORT"])
cur=conn.cursor()
cur=conn.cursor()

now_time = int(time.time())
old_time = (now_time - (30 * 24 * 60 * 60)) * 1000000000

sql1 = (
"select "
Expand All @@ -63,7 +67,7 @@ def get_actions(network_id, account_id):
"status "
"from action_receipt_actions join receipts using(receipt_id) "
"join execution_outcomes using(receipt_id) "
"where action_kind = 'FUNCTION_CALL' and ( "
"where action_kind = 'FUNCTION_CALL' and included_in_block_timestamp > %s and ( " % old_time
)

sql2 = """(predecessor_account_id = %s and """
Expand Down