Add task sorting by updatedAt (descending) in all views
- BacklogView: Sort current sprint tasks, backlog, and other sprint tasks by last updated - SprintBoard: Sort sprint tasks by updatedAt descending - Ensures latest updated tasks appear at top of each section
This commit is contained in:
parent
02d19a1afb
commit
418bf7a073
@ -25,8 +25,9 @@ function create_task() {
|
|||||||
local title="$1"
|
local title="$1"
|
||||||
local status="${2:-open}"
|
local status="${2:-open}"
|
||||||
local priority="${3:-medium}"
|
local priority="${3:-medium}"
|
||||||
local project_id="${4:-1}"
|
local project_id="${4:-a1b2c3d4-0001-0000-0000-000000000001}"
|
||||||
local assignee_id="${5:-9c29cc99-81a1-4e75-8dff-cd7cc5ceb5aa}"
|
local assignee_id="${5:-9c29cc99-81a1-4e75-8dff-cd7cc5ceb5aa}"
|
||||||
|
local task_type="${6:-task}"
|
||||||
|
|
||||||
local uuid=$(uuidgen | tr '[:upper:]' '[:lower:]')
|
local uuid=$(uuidgen | tr '[:upper:]' '[:lower:]')
|
||||||
local now=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
local now=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||||
@ -36,6 +37,7 @@ function create_task() {
|
|||||||
-d "{
|
-d "{
|
||||||
\"id\": \"$uuid\",
|
\"id\": \"$uuid\",
|
||||||
\"title\": \"$title\",
|
\"title\": \"$title\",
|
||||||
|
\"type\": \"$task_type\",
|
||||||
\"status\": \"$status\",
|
\"status\": \"$status\",
|
||||||
\"priority\": \"$priority\",
|
\"priority\": \"$priority\",
|
||||||
\"project_id\": \"$project_id\",
|
\"project_id\": \"$project_id\",
|
||||||
|
|||||||
@ -318,12 +318,15 @@ export function BacklogView({ searchQuery = "" }: BacklogViewProps) {
|
|||||||
// Get other sprints (not current)
|
// Get other sprints (not current)
|
||||||
const otherSprints = sprints.filter((s) => s.id !== currentSprint?.id)
|
const otherSprints = sprints.filter((s) => s.id !== currentSprint?.id)
|
||||||
|
|
||||||
// Get tasks by section
|
// Sort tasks by updatedAt (descending) - latest first
|
||||||
|
const sortByUpdated = (a: Task, b: Task) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()
|
||||||
|
|
||||||
|
// Get tasks by section (sorted by last updated)
|
||||||
const currentSprintTasks = currentSprint
|
const currentSprintTasks = currentSprint
|
||||||
? tasks.filter((t) => t.sprintId === currentSprint.id && matchesSearch(t))
|
? tasks.filter((t) => t.sprintId === currentSprint.id && matchesSearch(t)).sort(sortByUpdated)
|
||||||
: []
|
: []
|
||||||
|
|
||||||
const backlogTasks = tasks.filter((t) => !t.sprintId && matchesSearch(t))
|
const backlogTasks = tasks.filter((t) => !t.sprintId && matchesSearch(t)).sort(sortByUpdated)
|
||||||
|
|
||||||
// Get active task for drag overlay
|
// Get active task for drag overlay
|
||||||
const activeTask = activeId ? tasks.find((t) => t.id === activeId) : null
|
const activeTask = activeId ? tasks.find((t) => t.id === activeId) : null
|
||||||
@ -414,7 +417,7 @@ export function BacklogView({ searchQuery = "" }: BacklogViewProps) {
|
|||||||
{otherSprints
|
{otherSprints
|
||||||
.sort((a, b) => new Date(a.startDate).getTime() - new Date(b.startDate).getTime())
|
.sort((a, b) => new Date(a.startDate).getTime() - new Date(b.startDate).getTime())
|
||||||
.map((sprint) => {
|
.map((sprint) => {
|
||||||
const sprintTasks = tasks.filter((t) => t.sprintId === sprint.id && matchesSearch(t))
|
const sprintTasks = tasks.filter((t) => t.sprintId === sprint.id && matchesSearch(t)).sort(sortByUpdated)
|
||||||
console.log(`Sprint ${sprint.name}: ${sprintTasks.length} tasks`, sprintTasks.map(t => t.title))
|
console.log(`Sprint ${sprint.name}: ${sprintTasks.length} tasks`, sprintTasks.map(t => t.title))
|
||||||
return (
|
return (
|
||||||
<SectionDropZone key={sprint.id} id={`sprint-${sprint.id}`}>
|
<SectionDropZone key={sprint.id} id={`sprint-${sprint.id}`}>
|
||||||
|
|||||||
@ -189,8 +189,10 @@ export function SprintBoard() {
|
|||||||
// Get current sprint
|
// Get current sprint
|
||||||
const currentSprint = sprints.find((s) => s.id === selectedSprintId)
|
const currentSprint = sprints.find((s) => s.id === selectedSprintId)
|
||||||
|
|
||||||
// Get tasks for current sprint
|
// Get tasks for current sprint, sorted by updatedAt descending (latest first)
|
||||||
const sprintTasks = tasks.filter((t) => t.sprintId === selectedSprintId)
|
const sprintTasks = tasks
|
||||||
|
.filter((t) => t.sprintId === selectedSprintId)
|
||||||
|
.sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime())
|
||||||
|
|
||||||
// Group tasks by status
|
// Group tasks by status
|
||||||
const tasksByStatus = statusColumns.reduce((acc, status) => {
|
const tasksByStatus = statusColumns.reduce((acc, status) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user