# Pomodoro Timer

> **Note: Availability**
> This workflow uses functionality that is only available using the JavaScript Editor. This means that it is unavailable for editing in the Workflow Constructor.
>
>
>
> To learn more about this workflow, refer to the corresponding page in our [Developer Portal](https://www.jetbrains.com.cn/en-us/help/youtrack/devportal/Workflow-Pomodoro-Timer.html).

This workflow supports the [Pomodoro Technique](https://www.pomodorotechnique.com/), a time management method developed by Francesco Cirillo in the late 1980s.

> **Note: Synchronization with Time Tracking**
> Workflow timers are synchronized with the global time tracking settings for your server. Timers only record time on workdays and do not exceed the defined working period per day.
>
>
>
> The timer pauses automatically as soon as the tracked time reaches the maximum working period for a single day. If the timer isn't stopped (manually or programmatically) before the start of the next working day, it resumes tracking from 09:00. The timer is also paused automatically at the start of any non-working day.
>
>
>
> The dates and times are based on the local time zone for the current user.
>
>
>
> For best results, we recommend that you always stop the timer when you finish your work activity. If you find that a workflow has recorded an inaccurate amount of spent time, update the work item manually.

| Name | @jetbrains/youtrack-workflow-pomodoro-timer |
| Auto-attached | no |
| Rules |      * Define transitions for "State" field with Pomodoro timer (state-machine)    * Enable Pomodoro countdown (on-schedule)    * Block changes to interruption cause without stopping timer (on-change)    |

Procedure: To enable this workflow:

1. Enable and configure time tracking for your project.

2. Add an enumerated field with the name Pomodoro state to your project. Add the values Timer's running, Not set, Timer finished, and On a break to the field.

3. Add an enumerated field with the name Pomodoro interruption to your project. Add the values Boss interrupted, Facebook chat, Phone call, and Urgent email to the field.

4. Add an integer-type field with the name Pomodoro countdown to your project.

5. Attach the Pomodoro Timer workflow to your project.

## Use Case

This workflow lets users follow the Pomodoro time management strategy. The Pomodoro technique works like this:

* Periods of activity are divided into equal intervals of time, which are called "pomodoros."

* A traditional pomodoro is 30 minutes long: 25 minutes of work plus a 5-minute break.

* Every four pomodoros, you are allowed to take a longer break of 15 to 30 minutes.

* A pomodoro cannot be interrupted or split up. It marks 25 minutes of pure work.

* If interruptions occur, you stop your pomodoro and log the cause of the interruption.

## Rules

This workflow includes three rules.

| Title | Description |
| --- | --- |
| Define transitions for "State" field with Pomodoro timer | This state-machine rule defines how a Pomodoro transitions from state to state. The beauty of this rule is that for each finished or interrupted Pomodoro, YouTrack automatically adds a new work item, automatically logging your work for a particular issue.    |
| Enable Pomodoro countdown | This on-schedule rule runs a timer that starts a 25-minute countdown.   |
| Block changes to interruption cause without stopping timer | This on-change rule prevents the user from changing the cause of an interruption (by entering a value in the Pomodoro interruption field) without stopping the timer.     |

