Skip to content

fixed code for few problems #1

@ROOMBON

Description

@ROOMBON

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))

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions