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

Fix #1730: Available lake data end time is not updated #1731

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
17 changes: 16 additions & 1 deletion pdr_backend/pdr_dashboard/util/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ def payouts_from_bronze_predictions(
Returns:
list: List of predictions data.
"""

# Start constructing the SQL query
query = f"""SELECT * FROM
{tbl_parquet_path(self.lake_dir, BronzePrediction)}
Expand Down Expand Up @@ -453,6 +452,7 @@ def feeds_metrics(self) -> dict[str, Union[int, float]]:

@enforce_types
def predictoors_metrics(self) -> dict[str, Union[int, float]]:

query_predictoors_metrics = f"""
SELECT
COUNT(DISTINCT(user)) AS predictoors,
Expand Down Expand Up @@ -521,6 +521,11 @@ def get_first_and_last_slot_timestamp(self) -> Tuple[UnixTimeS, UnixTimeS]:

@enforce_types
def refresh_feeds_data(self) -> None:
# Refresh the timestamps
self.min_timestamp, self.max_timestamp = (
self.get_first_and_last_slot_timestamp()
)

self.feeds_metrics_data = self.feeds_metrics()
self.feeds_payout_stats = self._init_feed_payouts_stats()
self.feeds_subscriptions = self._init_feed_subscription_stats()
Expand All @@ -532,6 +537,11 @@ def refresh_feeds_data(self) -> None:

@enforce_types
def refresh_predictoors_data(self) -> None:
# Refresh the timestamps
self.min_timestamp, self.max_timestamp = (
self.get_first_and_last_slot_timestamp()
)

self.predictoors_metrics_data = self.predictoors_metrics()
self.predictoors_data = self._init_predictoor_payouts_stats()

Expand Down Expand Up @@ -715,6 +725,11 @@ def homepage_predictoors_cols(self) -> Tuple[Tuple, pl.DataFrame]:
return (columns, hidden_columns), data

def get_feeds_for_favourite_predictoors(self, feed_data, predictoor_addrs):
# Refresh the timestamps
self.min_timestamp, self.max_timestamp = (
self.get_first_and_last_slot_timestamp()
)

feed_ids = self.feed_ids_based_on_predictoors(predictoor_addrs)

if not feed_ids:
Expand Down