Skip to content

Commit

Permalink
Switch from camelCase to snake_case to fix dashboard urls (#403)
Browse files Browse the repository at this point in the history
This PR fixes some inconsistencies with the msgs being printed it out by
the script and the dashboard urls that are generated
  • Loading branch information
harisang authored Oct 1, 2024
1 parent 47a6a3e commit 5163d0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/models/accounting_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __hash__(self) -> int:
)

def as_query_params(self) -> list[QueryParameter]:
"""Returns commonly used (StartTime, EndTime) query parameters"""
"""Returns commonly used (start_time, end_time) query parameters"""
return [
QueryParameter.date_type("start_time", self.start),
QueryParameter.date_type("end_time", self.end),
Expand All @@ -41,11 +41,11 @@ def dashboard_url(self) -> str:
"""Constructs Solver Accounting Dashboard URL for Period"""
base = "https://dune.com/cowprotocol/"
slug = "cow-solver-rewards"
query = f"?StartTime={self.start}&EndTime={self.end}"
query = f"?start_time={self.start}&end_time={self.end}"
return base + urllib.parse.quote_plus(slug + query, safe="=&?")

def unusual_slippage_url(self) -> str:
"""Returns a link to unusual slippage query for period"""
base = "https://dune.com/queries/1688044"
query = f"?StartTime={self.start}&EndTime={self.end}"
base = "https://dune.com/queries/2332678"
query = f"?start_time={self.start}&end_time={self.end}"
return base + urllib.parse.quote_plus(query, safe="=&?")
4 changes: 2 additions & 2 deletions tests/unit/test_data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class TestDataUtils(unittest.TestCase):
def test_dashboard_url(self):
expected = (
"https://dune.com/cowprotocol/cow-solver-rewards?"
"StartTime=2022-05-31+00%3A00%3A00&"
"EndTime=2022-06-07+00%3A00%3A00"
"start_time=2022-05-31+00%3A00%3A00&"
"end_time=2022-06-07+00%3A00%3A00"
)
result = AccountingPeriod("2022-05-31").dashboard_url()
self.assertEqual(
Expand Down

0 comments on commit 5163d0f

Please sign in to comment.