# Sync behaviour & troubleshooting

What docket does on its own once a project is [linked](https://docket.rocks/en/docs/jira-project-linking), and what to
check when a ticket or a time entry looks wrong.

---

## How often does docket sync with Jira?

docket checks Jira on a schedule instead of waiting for Jira to notify it:

| What | How often |
|---|---|
| **New & changed Jira tickets** (title, status, assignee, due date, priority) | about every **5 minutes** |
| **Time logged directly in Jira** (imported into docket) | about every **5 minutes** |
| **Tickets deleted or moved out** of the Jira project | once a **day** (closed in docket, tracked time kept) |
| **First import** when you link a project | **right away** in the background (large projects take a while) |

**Time you book in docket goes to Jira immediately**, not on this schedule. When you save, edit or
delete a time entry on a Jira ticket, docket updates the Jira worklog straight away and retries
automatically if Jira is briefly unavailable.

---

## Can I accidentally push the same time twice?

**No.** Each docket time entry is tied to exactly **one** Jira worklog by a stored id. The first
push **creates** the worklog. Every later push (an edit, **Sync existing docket time to Jira now**,
a double click, an automatic retry) **updates that same worklog**, so pressing the sync button
repeatedly is safe.

- **Edit or delete an entry in docket:** the Jira worklog is updated or deleted along with it.
- **Edit a docket-pushed worklog in Jira:** docket doesn't pull the change back. For time booked in
  docket, **docket is the source of truth**, and your next edit in docket overwrites the Jira side.
- **Time logged only in Jira** is imported read-only, and edits to it in Jira *do* update docket.

---

## What about people who log time in Jira but have no docket account?

Their worklogs still come over. What happens to them depends on the connection's setting
**Jira authors without a docket account** (Administration → Integrations → the connection):

- **On (the default), with a service chosen:** when the first worklog from such a Jira account
  arrives, docket creates a **placeholder user** and books the time to it. That time counts in
  budgets, Controlling and reports at the placeholder's service rate. Placeholders can't sign in,
  take no seat and are listed separately under **Administration → Users → Jira placeholders**.
  There an admin can:
  - change the **service** a placeholder's time is billed at (e.g. different rates for an
    external agency and a freelancer);
  - **convert** worklogs imported before the placeholder existed (until then they're read-only
    rows, and docket never converts them on its own);
  - **merge** the placeholder into a real user once the person gets a docket account. Their time,
    ticket assignments and Jira mapping move over, and the placeholder disappears.
- **Off, or no service chosen:** the worklogs stay **read-only rows**. They're visible per author
  in the project's Controlling under *Timetrackings*, but without a rate and outside budgets and
  reports.

A placeholder's time is only converted on projects whose link has **Convert Jira worklogs** on.

---

## How do epics, stories and sub-tasks appear?

**Each as its own docket ticket, with sub-tasks under their parent.** Every Jira issue in scope
(epic, story, task, bug or sub-task) is mirrored as one docket ticket. Time therefore lands exactly
where it was logged in Jira: on a sub-task, on its parent, or on both. Nothing is counted twice.

- A **sub-task** is listed right below its parent in the Jira section of the Tickets tab, and in
  the time-entry picker as `ABC-12 › ABC-15`. Its ticket page links to the parent. The parent's
  page lists its sub-tasks and the **time incl. sub-tasks** (Jira's aggregate).
- Sub-tasks **don't count** towards a project's open/closed ticket figures (dashboard dots, project
  list). Their time counts as usual.
- The ticket page shows the Jira issue type. Epics and any grouping beyond parent → sub-task stay
  in Jira. With an epic scope (see [linking](https://docket.rocks/en/docs/jira-project-linking)) the epic itself is
  mirrored too, so time logged on it has a place.

---

## What about open and closed (done) issues?

**Jira decides the status; docket follows.** A mirrored ticket is **closed** in docket when its
Jira issue is in a **Done** status category, and **open** for any other status. Close or reopen
the issue in Jira, and the docket ticket follows on the next sync (within a few minutes).

Mirrored tickets are read-only in docket. The only thing you add from docket is tracked time;
status and everything else are edited in Jira.

- **Closed issues are imported too.** The first sync pulls the whole Jira project, so done issues
  arrive as closed tickets and the time logged on them stays visible in docket's reports.
- **Workload ignores closed tickets.** The heatmap and the "assigned tickets" counts only include
  **open** tickets.
- **You can still book time on a closed ticket.** It stays selectable in time tracking, and closing
  an issue never removes its time from budget, Controlling or reports.
- An issue **deleted or moved out** of the Jira project (not just closed) is closed in docket by
  the daily check, with its time kept.

---

## Troubleshooting

| Symptom | What it means / what to do |
|---|---|
| Connection shows **auth failed** | The service account's email or token is wrong or has lost access. An admin edits the connection, re-enters the token and tests the connection again. |
| A time entry says **Not in Jira — connect your Jira account** | You haven't connected your Jira account yet. The link opens your settings (see [Part 2 of the setup](https://docket.rocks/en/docs/jira-setup)). Once you're connected, waiting entries go to Jira by themselves. |
| A time entry says **Not in Jira — your Jira account isn't mapped yet** | The connection books through **Tempo**, which logs time on your behalf, so an admin has to map your Jira account (Administration → Integrations → the connection → User mapping). After that, waiting entries go to Jira by themselves. |
| A time entry says **Jira sync failed** | Usually a temporary Jira hiccup or a permissions change. Click **Retry**. If it keeps failing, check in your profile settings that your Jira connection still shows ✓ for that site, and that you can access the project in Jira. |
| My token shows **✗** for a site | Your Atlassian account can't reach that site, or you use a different account there. Add a token *scoped to that connection*, or ask the admin for access. |
| A Jira ticket isn't showing in docket | New issues arrive within a few minutes. If it never appears, check that the issue is in the linked Jira project and that the connection badge is green. |
| A linked project shows **no Jira tickets at all** | The connection's Jira account can't see the project's issues, and Jira answers with an empty list instead of an error. Project → Settings → Jira shows this in red. In Jira, add that account to the project (*Project settings → Access*, e.g. on team-managed projects) or give it the **Browse projects** permission. The tickets arrive with the next sync, or right away with **Sync tickets from Jira now** on that settings page. |
| Boards / Roadmap tabs disappeared | Expected: the project is linked with *Jira replaces the tickets area*, so planning happens in Jira. Switch the Tickets area to *Jira extends it* (Project → Settings → Jira) to keep docket's own tickets, boards and roadmap next to the Jira tickets, or unlink the project. |
| I unlinked a project. Did I lose data? | No. All tracked time and every mirrored ticket with booked time are kept. Only empty mirrored tickets (no time booked, nothing imported) are removed. Syncing stops. |
| I deleted the Jira connection. Did I lose data? | No. Every linked project is unlinked the same way, and the hours imported from Jira stay in Controlling. If you connect the same Jira site again, they're picked up instead of imported twice. |
| I linked the wrong Jira project | Unlink it and link the right one. Empty imported tickets are cleaned up automatically. If time was already booked, see [linked the wrong Jira project](https://docket.rocks/en/docs/jira-project-linking). |
| A time entry was booked on the wrong project/ticket | In **Timetracking → Reports**, select the entries and use **Move**. On Jira-mirrored tickets the worklog moves along (removed from the old issue, created on the new one). |

---

Still stuck? Start again from the [overview](https://docket.rocks/en/docs/jira-user-guide), or check the
[connection setup](https://docket.rocks/en/docs/jira-setup).