fix percentage reporting semantics
This wasn't actually (much) broken, but we got burnt because percent should mean [0, 100], not [0, 1].
This commit is contained in:
parent
cc0ba96a9e
commit
5ad4946f5b
1 changed files with 6 additions and 5 deletions
|
|
@ -186,16 +186,17 @@ async def import_from_file(*, basics_path: Path, ratings_path: Path):
|
||||||
log.info("💾 Importing movies ...")
|
log.info("💾 Importing movies ...")
|
||||||
total = count_lines(basics_path)
|
total = count_lines(basics_path)
|
||||||
assert total != 0
|
assert total != 0
|
||||||
perc = 0.0
|
perc_next_report = 0.0
|
||||||
perc_step = 0.001
|
perc_step = 0.1
|
||||||
|
|
||||||
chunk = []
|
chunk = []
|
||||||
|
|
||||||
for i, m in enumerate(read_basics(basics_path)):
|
for i, m in enumerate(read_basics(basics_path)):
|
||||||
|
|
||||||
if i / total > perc:
|
perc = 100 * i / total
|
||||||
log.info("⏳ Imported %s%%", round(perc * 100, 1))
|
if perc >= perc_next_report:
|
||||||
perc += perc_step
|
log.info("⏳ Imported %s%%", round(perc, 1))
|
||||||
|
perc_next_report += perc_step
|
||||||
|
|
||||||
if m.media_type not in {
|
if m.media_type not in {
|
||||||
"Movie",
|
"Movie",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue