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

fixed code for few problems #1

Open
ROOMBON opened this issue Oct 28, 2023 · 0 comments
Open

fixed code for few problems #1

ROOMBON opened this issue Oct 28, 2023 · 0 comments

Comments

@ROOMBON
Copy link

ROOMBON commented Oct 28, 2023

There are some problems with the current code:

  1. At the end of the current cycle of the daf hayomi something goes wrong.
  2. There is an error in the maseches brachos.
  3. Starting with the next cycle of the daf hayomi (after brachos) he does not give a correct page.
    The correct code should apparently be as follows:

`

def today_daf(daf_date=None) -> Tuple:
    first_cycle = date(1923, 9, 23)
    scheduling = mw.col.conf.get("rollover", 4)
    delta = timedelta(hours=scheduling)
    if daf_date is not None:
        cur = daf_date
    else:
        if datetime.today().hour < delta.seconds // 3600:
            cur = date.today() - timedelta(days=1)
        else:
            cur = date.today()
    days_since = cur - first_cycle
    days_since = days_since.days
    total_dapim = sum(mesekhtot.values())
    dapim_in_current_cycle = days_since % total_dapim
    dapim_in_current_cycle += 63
    dapim_in_current_cycle += 12
 
    count = 0
    for mesekhta, pages in mesekhtot.items():
        count += 1
        # print(count)
        if dapim_in_current_cycle < pages:
            if mesekhta == "קינים":
                dapim_in_current_cycle += 21
            if mesekhta == "תמיד":
                dapim_in_current_cycle += 25
            if mesekhta == "מדות":
                dapim_in_current_cycle += 33
            return (mesekhta, _num_to_str(dapim_in_current_cycle + 2, False))
            # break
        dapim_in_current_cycle = dapim_in_current_cycle - pages
    return ("ברכות", _num_to_str(dapim_in_current_cycle + 2, False))

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant