# Code Request — Code Queue Badge Fix

**Filed by:** Chronicler #88
**Date:** 2026-04-14
**Priority:** Quick fix

---

## Problem

The Code Queue badge (cyan count next to "Tasks" in sidebar) is not showing.
It was in the spec for REQ-2026-04-14-task-module-improvements.md but was
not implemented in the layout or route.

---

## Fix Required

### 1. `src/routes/admin/index.js` — middleware that runs on every admin request

Add a query that counts tasks where tags contains 'code' AND status is open/in_progress:

```javascript
// Add to the middleware that runs before all admin routes
const codeQueueResult = await db.query(
    "SELECT COUNT(*) FROM tasks WHERE 'code' = ANY(tags) AND status IN ('open', 'in_progress')"
);
res.locals.codeQueueCount = parseInt(codeQueueResult.rows[0].count) || 0;
```

### 2. `src/views/layout.ejs` — sidebar Tasks link

Find the Tasks nav link and add the badge:

```html
🗂️ Tasks
<% if (locals.codeQueueCount > 0) { %>
  <span style="background:#06b6d4;color:#fff;border-radius:9999px;font-size:10px;padding:1px 6px;margin-left:4px;font-weight:700;">
    <%= codeQueueCount %>
  </span>
<% } %>
```

---

## Notes
- Must use `res.locals` so it's available in layout without passing per-route
- Only show badge if count > 0

**Fire + Frost + Foundation** 💙🔥❄️
