From e18adc84f1528f6d21bc310bc0e17402794f6e85 Mon Sep 17 00:00:00 2001 From: ConfusedPolarBear <33811686+ConfusedPolarBear@users.noreply.github.com> Date: Sun, 25 Sep 2022 17:13:59 -0500 Subject: [PATCH] Display formatted timestamps in reports --- .../e2e_tests/verifier/report.html | 4 ++-- .../e2e_tests/verifier/report_comparison.go | 4 ++++ .../e2e_tests/verifier/structs/intro.go | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper.Tests/e2e_tests/verifier/report.html b/ConfusedPolarBear.Plugin.IntroSkipper.Tests/e2e_tests/verifier/report.html index 75e5bb9..f030b0d 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper.Tests/e2e_tests/verifier/report.html +++ b/ConfusedPolarBear.Plugin.IntroSkipper.Tests/e2e_tests/verifier/report.html @@ -228,11 +228,11 @@

{{ $episode.Title }}

- Old: {{ $old.IntroStart }} - {{ $old.IntroEnd }} + Old: {{ $old.FormattedStart }} - {{ $old.FormattedEnd }} ({{ $old.Duration }}) (valid: {{ $old.Valid }})
- New: {{ $new.IntroStart }} - {{ $new.IntroEnd }} + New: {{ $new.FormattedStart }} - {{ $new.FormattedEnd }} ({{ $new.Duration }}) (valid: {{ $new.Valid }})
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper.Tests/e2e_tests/verifier/report_comparison.go b/ConfusedPolarBear.Plugin.IntroSkipper.Tests/e2e_tests/verifier/report_comparison.go index 416876a..92c62e1 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper.Tests/e2e_tests/verifier/report_comparison.go +++ b/ConfusedPolarBear.Plugin.IntroSkipper.Tests/e2e_tests/verifier/report_comparison.go @@ -107,6 +107,10 @@ func unmarshalReport(path string) structs.Report { // Round the duration to the nearest second to avoid showing 8 decimal places in the report intro.Duration = float32(math.Round(float64(intro.Duration))) + // Pretty print the intro start and end times + intro.FormattedStart = (time.Duration(intro.IntroStart) * time.Second).String() + intro.FormattedEnd = (time.Duration(intro.IntroEnd) * time.Second).String() + show, season := intro.Series, intro.Season // If this show hasn't been seen before, allocate space for it diff --git a/ConfusedPolarBear.Plugin.IntroSkipper.Tests/e2e_tests/verifier/structs/intro.go b/ConfusedPolarBear.Plugin.IntroSkipper.Tests/e2e_tests/verifier/structs/intro.go index 139effe..1a6ba2c 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper.Tests/e2e_tests/verifier/structs/intro.go +++ b/ConfusedPolarBear.Plugin.IntroSkipper.Tests/e2e_tests/verifier/structs/intro.go @@ -12,6 +12,9 @@ type Intro struct { Duration float32 Valid bool + FormattedStart string + FormattedEnd string + ShowSkipPromptAt float32 HideSkipPromptAt float32 }