YouTrack および Hub ヘルプの開発者ポータル

Pomodoro タイマー

このワークフローは、1980 年代後半に Francesco Cirillo によって開発された時間管理方法である Pomodoro テクニック(英語)をサポートしています。

名前

@jetbrains/youtrack-workflow-pomodoro-timer

自動添付

いいえ

モジュール

Pomodoro タイマーで "State" フィールドの遷移を定義する (ステートマシンの規則)

Pomodoro カウントダウンを有効にする (スケジュールルール)

タイマーを停止せずに割り込み要因への変更をブロック (変更時のルール)

このワークフローを有効にするには

  1. プロジェクトのタイムトラッキングを有効にして設定します。

  2. プロジェクトに Pomodoro 状態という名前の列挙型フィールドを追加します。値タイマーの実行未設定タイマー終了休憩中をフィールドに追加します。

  3. プロジェクトに Pomodoro 割り込みという名前の列挙型フィールドを追加します。値上司は中断しましたFacebook チャット電話緊急メールをフィールドに追加します。

  4. プロジェクトに Pomodoro カウントダウンという名前の整数型フィールドを追加します。

  5. Pomodoro タイマーワークフローをプロジェクトにアタッチしてください。

ユースケース

このワークフローにより、ユーザーは Pomodoro 時間管理戦略に従うことができます。Pomodoro 手法は次のように機能します。

  • 活動の期間は「ポモドーロ」と呼ばれる等しい時間間隔に分割されます。

  • 伝統的なポモドーロは 30 分の長さで、25 分の作業と 5 分の休憩があります。

  • 4 ポモドーロごとに、15 〜 30 分の長い休憩を取ることが許可されています。

  • ポモドーロを中断したり分割したりすることはできません。それは 25 分の純粋な作業の印です。

  • 中断が発生した場合は、pomodoro を停止して中断の原因を記録します。

モジュール

このワークフローには 3 つのモジュールがあります。

Pomodoro タイマーで "State" フィールドの遷移を定義する

最初のモジュールには、Pomodoro が状態から状態へどのように遷移するかを定義するステートマシン規則が含まれています。この規則の長所は、Pomodoro が終了または中断されるたびに、YouTrack が自動的に新しい作業項目を追加することです。それは自動的にあなたの作業を特定の課題について記録します !

const entities = require('@jetbrains/youtrack-scripting-api/entities'); const workflow = require('@jetbrains/youtrack-scripting-api/workflow'); exports.rule = entities.Issue.stateMachine({ title: 'Define transitions for "State" field with Pomodoro timer', fieldName: 'Pomodoro state', states: { 'Not set': { initial: true, transitions: { start: { targetState: 'Timer’s running' } } }, 'Timer’s running': { onEnter: (ctx) => { ctx.issue.fields['Pomodoro interruption'] = null; workflow.message('25 minutes pomodoro is started.'); ctx.issue.fields['Pomodoro countdown'] = 25; }, transitions: { interrupt: { targetState: 'Not set', action: (ctx) => { ctx.issue.fields.required(ctx['Pomodoro interruption'], 'Please specify the interruption cause.'); ctx.issue.applyCommand(addWorkToday( (25 - ctx.issue.fields['Pomodoro countdown']) + 'm', 'Pomodoro was interrupted. The cause: \'' + ctx.issue.fields['Pomodoro interruption'].name + '\'.' )); ctx.issue.fields['Pomodoro countdown'] = null; } }, reminder: { targetState: 'Timer finished', after: minutes(25) } } }, 'Timer finished': { transitions: { 'take a break': { targetState: 'On a break', action: (ctx) => { workflow.message('5 minutes break.'); ctx.issue.applyCommand(addWorkToday('25m', '+1 pomodoro.')); ctx.issue.fields['Pomodoro countdown'] = 5; } }, 'discard': { targetState: 'Not set', action: (ctx) => { ctx.issue.fields.required(ctx['Pomodoro interruption'], 'Please specify the interruption cause.'); ctx.issue.applyCommand(addWorkToday( '25m', 'Pomodoro was discarded. The cause: \'' + ctx.issue.fields['Pomodoro interruption'].name + '\'.' )); ctx.issue.fields['Pomodoro countdown'] = null; } } } }, 'On a break': { transitions: { start: { targetState: 'Timer’s running', action: (ctx) => { ctx.issue.applyCommand(addWorkToday( (5 - ctx.issue.fields['Pomodoro countdown']) + 'm', '+1 short break.' )); } }, reminder: { targetState: 'Not set', after: minutes(5), action: (ctx) => { ctx.issue.applyCommand(addWorkToday('5m', '+1 break.')); } } } } }, requirements: { 'Pomodoro interruption': { type: entities.EnumField.fieldType }, 'Pomodoro countdown': { type: entities.Field.integerType } } }); function minutes(m) { return m * 60 * 1000; } function addWorkToday(countdown, message) { return 'add work Today ' + countdown + ' ' + message; }

Pomodoro カウントダウンを有効にする

2 番目のモジュールには、タイマーを実行して 25 分のカウントダウンを実行するスケジュールどおりのルールが含まれています。

const entities = require('@jetbrains/youtrack-scripting-api/entities'); exports.rule = entities.Issue.onSchedule({ title: 'Enable Pomodoro countdown', search: 'has: {Pomodoro countdown} AND Pomodoro countdown: -0 AND (Pomodoro state: {Timer’s running} OR Pomodoro state: {On a break})', cron: '0 * * * * ?', action: (ctx) => { const issueFields = ctx.issue.fields; issueFields['Pomodoro countdown'] -= 1; }, requirements: { 'PomodoroCountdown': { name: 'Pomodoro countdown', type: entities.Field.integerType }, 'PomodoroState': { name: 'Pomodoro state', type: entities.EnumField.fieldType } } });

タイマーを停止せずに割り込み要因への変更をブロック

最後のモジュールには、ユーザーがタイマーを停止せずに(Pomodoro 割り込みフィールドに値を入力して)割り込みの原因を変更できないようにする変更時ルールが含まれています。

// The Pomodoro technique is a time management method created by Francesco Cirillo in the 1980s. For details visit https://francescocirillo.com/products/the-pomodoro-technique const entities = require('@jetbrains/youtrack-scripting-api/entities'); const workflow = require('@jetbrains/youtrack-scripting-api/workflow'); exports.rule = entities.Issue.onChange({ title: 'Block changes to interruption cause without stopping timer', guard: (ctx) => { const issueFields = ctx.issue.fields; return issueFields.isChanged(ctx.PomodoroInterruption) && !issueFields.isChanged(ctx.PomodoroState); }, action: function () { workflow.check( false, 'Cannot change the interruption cause without changing the timer state.' ); }, requirements: { 'PomodoroInterruption': { name: 'Pomodoro interruption', type: entities.EnumField.fieldType, 'Boss interrupted': {}, 'Facebook chat': {}, 'Phone call': {}, 'Urgent email': {} }, 'PomodoroState': { name: 'Pomodoro state', type: entities.EnumField.fieldType } } });
2026 年 2 月 04 日