Add timers to capture

Open
#4 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
32/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
elixir
Domain
api, backend

Research direction

No files, tests, or entry points are named. Start by locating how captures are represented in the Phoenix API and how capture requests are tested, then trace the existing UI timer state if it is part of this repository. Done means captures support associated timers, enforce one newest running timer, calculate elapsed time correctly, and keep timer state consistent when requests fail.

Written by the indexing model from the issue text.

Description

A capture can have multiple timers.
Timer fields:

  • id
  • started_at
  • stopped_at
  • created_at
  • updated_at
  • id_capture: create association with capture

The stopped_at value can be null, in this case it means that the timer is running.
Only one timer can run for a capture and it should be the one created the most recently.

We can calculate the time spend on a capture by

  • if the most recent timer is running: sum stopped timers + (now - start_at running timer)
  • if all timers are stopped: sum of stopped timers (ie sum of stopped_at - started_at)

If a timer can't be started (e.g. http error) make sure the UI representing the timer is on "stop" and same if a timer can't be stopped

Dominant language
Elixir
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dwyl/app-api

All issues in dwyl/app-api

Similar issues

More Elixir issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.