kopia lustrzana https://github.com/bugout-dev/moonstream
Fix issues.
1) issue with enpty value in filter 2) issue with empty value in ethrium transaction request Add 1) Add urlencoding and replace null to 0 for timestamps 2) Add sorting by timestampspull/98/head
rodzic
f91422f071
commit
0631e2fb95
|
@ -84,6 +84,8 @@ async def get_transaction_in_blocks(
|
||||||
.filter(filters)
|
.filter(filters)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ethereum_transactions = ethereum_transactions_in_subscriptions
|
||||||
|
|
||||||
# If not start_time and end_time not present
|
# If not start_time and end_time not present
|
||||||
# Get latest transaction
|
# Get latest transaction
|
||||||
if boundaries.end_time == 0:
|
if boundaries.end_time == 0:
|
||||||
|
@ -92,10 +94,11 @@ async def get_transaction_in_blocks(
|
||||||
text("timestamp desc")
|
text("timestamp desc")
|
||||||
).limit(1)
|
).limit(1)
|
||||||
).one_or_none()
|
).one_or_none()
|
||||||
boundaries.end_time = ethereum_transaction_start_point[-1]
|
if ethereum_transaction_start_point:
|
||||||
boundaries.start_time = (
|
boundaries.end_time = ethereum_transaction_start_point[-1]
|
||||||
ethereum_transaction_start_point[-1] - DEFAULT_STREAM_TIMEINTERVAL
|
boundaries.start_time = (
|
||||||
)
|
ethereum_transaction_start_point[-1] - DEFAULT_STREAM_TIMEINTERVAL
|
||||||
|
)
|
||||||
|
|
||||||
if boundaries.start_time != 0 and boundaries.end_time != 0:
|
if boundaries.start_time != 0 and boundaries.end_time != 0:
|
||||||
if boundaries.start_time > boundaries.end_time:
|
if boundaries.start_time > boundaries.end_time:
|
||||||
|
@ -105,7 +108,7 @@ async def get_transaction_in_blocks(
|
||||||
)
|
)
|
||||||
|
|
||||||
if boundaries.end_time:
|
if boundaries.end_time:
|
||||||
ethereum_transactions = ethereum_transactions_in_subscriptions.filter(
|
ethereum_transactions = ethereum_transactions.filter(
|
||||||
include_or_not_lower(
|
include_or_not_lower(
|
||||||
EthereumBlock.timestamp, boundaries.include_end, boundaries.end_time
|
EthereumBlock.timestamp, boundaries.include_end, boundaries.end_time
|
||||||
)
|
)
|
||||||
|
|
|
@ -60,10 +60,10 @@ app.add_middleware(BroodAuthMiddleware, whitelist=whitelist_paths)
|
||||||
async def search_transactions(
|
async def search_transactions(
|
||||||
request: Request,
|
request: Request,
|
||||||
q: str = Query(""),
|
q: str = Query(""),
|
||||||
start_time: Optional[int] = Query(0), # Optional[int] = Query(0), #
|
start_time: Optional[int] = Query(0),
|
||||||
end_time: Optional[int] = Query(0), # Optional[int] = Query(0), #
|
end_time: Optional[int] = Query(0),
|
||||||
include_start: bool = Query(False),
|
include_start: Optional[bool] = Query(False),
|
||||||
include_end: bool = Query(False),
|
include_end: Optional[bool] = Query(False),
|
||||||
db_session: Session = Depends(db.yield_db_session),
|
db_session: Session = Depends(db.yield_db_session),
|
||||||
):
|
):
|
||||||
|
|
||||||
|
|
|
@ -80,8 +80,8 @@ const EntriesNavigation = () => {
|
||||||
const loadMoreButtonRef = useRef(null);
|
const loadMoreButtonRef = useRef(null);
|
||||||
|
|
||||||
const [streamBoundary, setStreamBoundary] = useState({
|
const [streamBoundary, setStreamBoundary] = useState({
|
||||||
start_time: null,
|
start_time: 0,
|
||||||
end_time: null,
|
end_time: 0,
|
||||||
include_start: false,
|
include_start: false,
|
||||||
include_end: true,
|
include_end: true,
|
||||||
next_event_time: null,
|
next_event_time: null,
|
||||||
|
@ -192,7 +192,7 @@ const EntriesNavigation = () => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
subscriptionsCache.data?.subscriptions[0]?.id &&
|
subscriptionsCache.data?.subscriptions[0]?.id &&
|
||||||
newFilterState[0].value === null
|
newFilterState[0]?.value === null
|
||||||
) {
|
) {
|
||||||
setFilterProps(0, {
|
setFilterProps(0, {
|
||||||
value: subscriptionsCache?.data?.subscriptions[0]?.address,
|
value: subscriptionsCache?.data?.subscriptions[0]?.address,
|
||||||
|
@ -514,8 +514,8 @@ const EntriesNavigation = () => {
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
remove();
|
remove();
|
||||||
setStreamBoundary({
|
setStreamBoundary({
|
||||||
start_time: null,
|
start_time: 0,
|
||||||
end_time: null,
|
end_time: 0,
|
||||||
include_start: false,
|
include_start: false,
|
||||||
include_end: true,
|
include_end: true,
|
||||||
next_event_time: null,
|
next_event_time: null,
|
||||||
|
@ -556,17 +556,19 @@ const EntriesNavigation = () => {
|
||||||
"" // some strange behaivior without else condition return 0 wich can see on frontend page
|
"" // some strange behaivior without else condition return 0 wich can see on frontend page
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
{entries.map((entry, idx) => (
|
{entries
|
||||||
<StreamEntry
|
?.sort((a, b) => b.timestamp - a.timestamp)
|
||||||
key={`entry-list-${idx}`}
|
.map((entry, idx) => (
|
||||||
entry={entry}
|
<StreamEntry
|
||||||
disableDelete={!canDelete}
|
key={`entry-list-${idx}`}
|
||||||
disableCopy={!canCreate}
|
entry={entry}
|
||||||
filterCallback={handleFilterStateCallback}
|
disableDelete={!canDelete}
|
||||||
filterConstants={{ DIRECTIONS, CONDITION, FILTER_TYPES }}
|
disableCopy={!canCreate}
|
||||||
/>
|
filterCallback={handleFilterStateCallback}
|
||||||
))}
|
filterConstants={{ DIRECTIONS, CONDITION, FILTER_TYPES }}
|
||||||
{streamBoundary.previous_event_time || isFetching ? (
|
/>
|
||||||
|
))}
|
||||||
|
{streamBoundary.previous_event_time && !isFetching ? (
|
||||||
<Center>
|
<Center>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
|
@ -59,7 +59,7 @@ const SubscriptionsList = () => {
|
||||||
{subscriptionsCache.data.subscriptions.map((subscription) => {
|
{subscriptionsCache.data.subscriptions.map((subscription) => {
|
||||||
let iconLink;
|
let iconLink;
|
||||||
switch (subscription.subscription_type_id) {
|
switch (subscription.subscription_type_id) {
|
||||||
case "1":
|
case "0":
|
||||||
iconLink =
|
iconLink =
|
||||||
"https://ethereum.org/static/c48a5f760c34dfadcf05a208dab137cc/31987/eth-diamond-rainbow.png";
|
"https://ethereum.org/static/c48a5f760c34dfadcf05a208dab137cc/31987/eth-diamond-rainbow.png";
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -43,6 +43,7 @@ const useJournalEntries = ({
|
||||||
//refetchInterval: refreshRate,
|
//refetchInterval: refreshRate,
|
||||||
...queryCacheProps,
|
...queryCacheProps,
|
||||||
keepPreviousData: true,
|
keepPreviousData: true,
|
||||||
|
retry: 3,
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
// response is object which return condition in getStream
|
// response is object which return condition in getStream
|
||||||
// TODO(andrey): Response should send page parameters inside "boundary" object (can be null).
|
// TODO(andrey): Response should send page parameters inside "boundary" object (can be null).
|
||||||
|
|
|
@ -15,9 +15,9 @@ export const getStream = ({
|
||||||
url: `${API}/streams/`,
|
url: `${API}/streams/`,
|
||||||
params: {
|
params: {
|
||||||
q: searchTerm,
|
q: searchTerm,
|
||||||
start_time: start_time,
|
start_time: encodeURIComponent(start_time),
|
||||||
end_time: end_time,
|
end_time: encodeURIComponent(end_time),
|
||||||
include_start: include_start,
|
include_start: encodeURIComponent(include_start),
|
||||||
include_end: include_end,
|
include_end: encodeURIComponent(include_end),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Ładowanie…
Reference in New Issue