Skip to content

Commit

Permalink
Fix omer selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Benyamin Ginzburg committed May 21, 2024
1 parent d6adbaf commit 0653706
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
12 changes: 6 additions & 6 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ dependencies = [
"sentry-sdk==1.13.0",
"aiogram-metrics==1.0.4",
"setuptools",
"urllib3>=2.2.1",
]
requires-python = ">=3.10"
requires-python = "==3.10.7"
license = {text = "-"}

[tool.pdm.scripts]
Expand Down
2 changes: 1 addition & 1 deletion zmanim_bot/service/settings_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async def get_current_omer() -> Tuple[str, InlineKeyboardMarkup]:

async def set_omer(call_data: str) -> InlineKeyboardMarkup:
omer_flag = not bool(int(call_data.split(CallbackPrefixes.omer)[1]))
zmanim = omer_flag and await zmanim_service.get_zmanim()
zmanim = omer_flag and await zmanim_service.get_zmanim(must_have_8_5=True)
await bot_repository.get_or_set_omer_flag(omer_flag, zmanim)

kb = keyboards.inline.get_omer_kb(omer_flag)
Expand Down
9 changes: 7 additions & 2 deletions zmanim_bot/service/zmanim_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@
from zmanim_bot.states import ZmanimGregorianDateState


async def get_zmanim() -> Zmanim:
async def get_zmanim(must_have_8_5: bool = False) -> Zmanim:
user = await bot_repository.get_or_create_user()
user_zmanim_settings = user.zmanim_settings

if must_have_8_5:
user_zmanim_settings.tzeis_8_5_degrees = True

data = await zmanim_api_client.get_zmanim(
user.location.coordinates,
user.zmanim_settings.dict()
user_zmanim_settings.dict()
)
return data

Expand Down

0 comments on commit 0653706

Please sign in to comment.