Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accumulate timers #103

Closed
3 tasks done
nelsonic opened this issue Jul 16, 2022 · 9 comments
Closed
3 tasks done

Accumulate timers #103

nelsonic opened this issue Jul 16, 2022 · 9 comments
Assignees
Labels
enhancement New feature or enhancement of existing functionality help wanted If you can help make progress with this issue, please comment! in-progress An issue or pull request that is being worked on by the assigned person priority-2 Second highest priority, should be worked on as soon as the Priority-1 issues are finished T4h Time Estimate 4 Hours technical A technical issue that requires understanding of the code, infrastructure or dependencies

Comments

@nelsonic
Copy link
Member

nelsonic commented Jul 16, 2022

At present when we stop a timer it disappears from the UI. 🤦‍♂️
Then when we start a new one it does not reflect the previous timers (if there are any) ...
This is obviously not the desired behaviour.
What we want is to:

@nelsonic nelsonic added enhancement New feature or enhancement of existing functionality help wanted If you can help make progress with this issue, please comment! technical A technical issue that requires understanding of the code, infrastructure or dependencies T4h Time Estimate 4 Hours labels Jul 16, 2022
@nelsonic nelsonic self-assigned this Jul 16, 2022
@nelsonic nelsonic added this to More ToDo ThanCanEver Be Done in Nelson's List via automation Jul 16, 2022
@nelsonic nelsonic pinned this issue Jul 16, 2022
@nelsonic nelsonic added the priority-2 Second highest priority, should be worked on as soon as the Priority-1 issues are finished label Jul 16, 2022
@nelsonic nelsonic moved this from More ToDo ThanCanEver Be Done to In progress in Nelson's List Jul 17, 2022
@nelsonic nelsonic added the in-progress An issue or pull request that is being worked on by the assigned person label Jul 17, 2022
@nelsonic
Copy link
Member Author

making a stab at this now. have a decent idea of how to achieve it. 🧑‍💻 🤞 ⏳

@nelsonic
Copy link
Member Author

The fun part is writing tests ... 💭

@nelsonic
Copy link
Member Author

@nelsonic
Copy link
Member Author

  1) test accumulate timers #103 accummulate_item_timers/1 to display cummulative timer (App.TimerTest)
     test/app/timer_test.exs:41
     ** (Enum.EmptyError) empty error
     code: acc = Item.accumulate_item_timers(items_with_timers)
     stacktrace:
       (elixir 1.13.4) lib/enum.ex:2342: Enum.reduce/2
       (app 0.1.0) lib/app/item.ex:209: anonymous fn/3 in App.Item.accumulate_item_timers/1
       (elixir 1.13.4) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
       (elixir 1.13.4) lib/map.ex:236: Map.new_from_enum/2
       test/app/timer_test.exs:97: (test)

🙄

@nelsonic
Copy link
Member Author

Lucky guess: used Enum.reduce/3 instead of Enum.reduce/2. 🙄

@nelsonic
Copy link
Member Author

I've got this working ... but it's not pretty ... 😕

@nelsonic
Copy link
Member Author

But there's a test and lots of comments so it should be "refactorable" by someone smarter than me. 🤞

@nelsonic
Copy link
Member Author

GIF showing a timer being started, stopped and started again:
mvp-timer-accumulation

Obvs the disappearing timer isn't great UX.
Let's fix that!

GOTO: #106

@nelsonic
Copy link
Member Author

Confident this is working now:
mvp-edit-item-timer-displays-when-stopped

Had to port the timer_text/2 function to Elixir
cause there's a bug in LiveView that means
we can only have one Alpine.js component in a LiveView page:
alpinejs/alpine#911 🤦‍♂️

So server-sided rendering the stopped timer.
Which I actually think makes more sense as it's static. 👍

@nelsonic nelsonic moved this from In progress to Done in Nelson's List Jul 19, 2022
@nelsonic nelsonic unpinned this issue Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement of existing functionality help wanted If you can help make progress with this issue, please comment! in-progress An issue or pull request that is being worked on by the assigned person priority-2 Second highest priority, should be worked on as soon as the Priority-1 issues are finished T4h Time Estimate 4 Hours technical A technical issue that requires understanding of the code, infrastructure or dependencies
Projects
Nelson's List
  
Done
Development

No branches or pull requests

1 participant