-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Story
As a person wanting to maximise my personal effectiveness,
I want be able to associate (start|stop) a timer with a task (todo list item)
So that I can keep track of how much time I have spent on a given task.
Context
Most people listed "tracking time on a task" as highly desirable feature in #262 ❤️
It has always been one of our core objectives to track time against tasks.
One of the most frustrating things about most task/todo apps is that they don't have this feature!
Not being able to track the time spent on a task leads to people being distracted/unfocussed.
It's incredibly frustrating to work in a team where it's impossible to see what other teammates are working on or how long they has spent on a given task. This is a systematic problem of all "ticketing" systems like JIRA, Trello or Asana. It means everything takes longer than it needs to. Let's fix it.
Given that it's a "core" feature, we already have the Schema in place for attaching timers to items.
It's a one-to-many relationship which means an item can have multiple timers.
This means you can start|stop several timers for a given item and accumulate a total amount of time spent on a task over one or more sessions.
Todo
- Edit the
lib/app_web/templates/item/show.html.eextemplate to- Display the
iteminline instead of in a<ul><li>similar to the TodoMVC UI
- Display the
- Create the UI
<button class="{item.id}-start">tostart&stopa timer for a task. - Create a
<div class="{item.id}-timer">to display the timer for the task.- A timer should appear in the
<div>whenstartbutton is clicked.
- A timer should appear in the
- Create a new
testintest/app_web/controllers/timer_controller_test.exs- That tests for the insertion of a new
timerrecord in thetimerstable. - The new timer should be linked to an
item_id - The test should fail before the
functionis written (because this is new functionality) ...
- That tests for the insertion of a new
- Create a new
timerentry for theitem_idwhen thestartbutton is pressed.In case you are wondering why the
timerstable has both astartandinserted_atcolumn, it's so that theclientcan define thestart(the time when the timer was started),
but they cannot define/change theinserted_at(which is controlled by Phoenix/Postgres)
This is to mitigate "time travelling" (people always "starting" timers in the past) ...
The client can still define astartin the past, that's "OK" for people who forget to start a timer.
But the server will still "know" when thetimerwas actually inserted into the DB.
So someone waiting till the end of the day to retrospectively start/stop a bunch of timers to make it look like they have been super busy and used their time well will be informed otherwise.
People who don't use the app to improve their personal effectiveness by starting timers before they start working on a task, but rather invent a bunch of timers for a time-sheet will be flagged.
Don't mistake this for "big brother" watching you, it's "coach" making you a better teammate! - Write the (
Elixir)start_timer/1functionto be invoked to make the test pass. - Invoke
start_timer/1when thestartbutton is clicked/tapped. - Write
JavaScriptcode in that enhances the server-rendered page to:- Render a Clock in the form
HH:MM:SSin the<div>created above.- Only display relevant timer information to keep the UI clean i.e:
- When only a few seconds have passed show
SSe.g:7,8,9, etc. - When more than 9 seconds have passed show
10,11,12, etc. - After a minute has passed, show
1:01,1:02etc. where the0is now significant. - At
9:59(nine min and fifty-nine sec) add the next digit:10:00,10:01,10:02, etc. - Once
59:59has passed add the first hour digit:1:00:00 - Finally if the timer reaches
9:59:59, add the final digit of significance10:00:00
Note: this format for displaying the time is subject to discussion/change.
We just need something for now so that we can ship this feature!
For now we do not foresee a timer lasting more than 24 hours. (to be tested!)
But if Goggins starts using our app to time his runs we'll craft a UI just for him! - When only a few seconds have passed show
- Only display relevant timer information to keep the UI clean i.e:
- Update the clock each second.
- Render a Clock in the form
- Create a test for the
stop_timer/1function - Write the
stop_timer/1function to pass the test-
stop_timer/1should Update thetimerrecord with anendvalue
-
- Invoke
stop_timer/1when thestopbutton is clicked in the UI.
Proposed MVP UI/UX
This proposed UI/UX is just to create the MVP functionality.
It will change over time as we use the App and collect feedback.

https://www.figma.com/file/WrpkKGJNYZbeCzMRDVtvQLbC/dwyl-app?node-id=0%3A1
Walkthrough of UI/UX Screens:
- In this UI we can see a
listwith 5itemsin this case thelist.titleis "Todo List".
- A
startbutton is displayed on the right of eachitem
- When the
startfor a givenitemis clicked:
startbutton for thatitemis hidden- a
stopbutton appears - Hide the
startbuttons for all otheritems(to avoid multiple concurrent timers) - the
timeris displayed above thestopbutton. - the
timeris updated once per second to show the passing of time.
- When the
stopbutton for a timer that is running is clicked:
- Hide the
stopbutton - Stop the
timerfrom counting. (clearInterval(timer)) - Show the
starttimer
- If the person clicks/taps the "box" on the left of the
item.textto signal that theitemis done:
- Update the "box" to the "done" arrow version
- Strikethrough the
item.textto show that it is complete (feedback welcome on this UX) - Hide the
startbutton for thisitemas it's no longer relevant - Display the total time taken for the
item
Feedback on this issue/spec very much welcome. 🙏
I'm not "precious" about any of it, if you think we can do better UI/UX/functionality, comment!! 💬
I intend to start building it today. Once it's ready for review I will assign the PR. 📦
