AnkiDroid Vs. Anki Study Time

ankidroid says i studied 95294 minutes (1588.23 hours). but this script output says total is 1558 hours

2021 / 419.90416666653965 hours
2022 / 477.39999999984536 hours
2023 / 660.9811111109547 hours
Total study time: 1558.2852777784278 hours
import datetime

col = mw.col
cards = col.db.execute("SELECT id, time/1000 FROM revlog")

study_time_by_year = {}
total_study_time = 0

for card in cards:
    timestamp, study_time_seconds = card
    date = datetime.datetime.fromtimestamp(timestamp / 1000)
    year = date.year

    if year not in study_time_by_year:
        study_time_by_year[year] = 0

    study_time_hours = study_time_seconds / 3600  # convert seconds to hours
    study_time_by_year[year] += study_time_hours
    total_study_time += study_time_hours

for year, hours in study_time_by_year.items():
    print(f"{year} / {hours} hours")

print(f"Total study time: {total_study_time} hours")

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.