Convert year comparison to integer for accuracy

This commit is contained in:
Peter Norvig
2026-06-11 12:45:06 -07:00
committed by GitHub
parent 84616c6a9b
commit 59007a6145

View File

@@ -186,7 +186,7 @@ def find_newest(notebooks, label='New', year=new_year) -> None:
"""Mutate `notebooks['New']` to have a collection of newest notebooks.""" """Mutate `notebooks['New']` to have a collection of newest notebooks."""
for category in notebooks: for category in notebooks:
for line in notebooks[category]: for line in notebooks[category]:
if line[1] >= year: if int(line[1]) >= int(year):
notebooks[label].append(line) notebooks[label].append(line)
notebooks[label].sort(key=lambda line: (-line[1], line[0])) notebooks[label].sort(key=lambda line: (-line[1], line[0]))