[PR #2320] [MERGED] fix: use MinPositionSpacing threshold in calculateNewPositionForTask #8187

Closed
opened 2026-04-20 18:04:38 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2320
Author: @maggch97
Created: 2/28/2026
Status: Merged
Merged: 3/2/2026
Merged by: @kolaente

Base: mainHead: fix/task-position-min-spacing


📝 Commits (2)

  • 3b61b58 fix: use MinPositionSpacing threshold in calculateNewPositionForTask
  • 3f4bdf2 fix: use local variable for position to avoid cross-view contamination

📊 Changes

1 file changed (+5 additions, -4 deletions)

View changed files

📝 pkg/models/task_position.go (+5 -4)

📄 Description

calculateNewPositionForTask only checked for lowestPosition == 0 before triggering a full position recalculation. Extremely small position values (e.g. 3.16e-285) passed this check, causing new tasks to get meaningless positions via the index * 2^16 fallback, breaking sort order.

Use the same < MinPositionSpacing threshold that createPositionsForTasksInView and the position update handler already use.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2320 **Author:** [@maggch97](https://github.com/maggch97) **Created:** 2/28/2026 **Status:** ✅ Merged **Merged:** 3/2/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix/task-position-min-spacing` --- ### 📝 Commits (2) - [`3b61b58`](https://github.com/go-vikunja/vikunja/commit/3b61b58bd809df4fffce342244d6c5aac69edb53) fix: use MinPositionSpacing threshold in calculateNewPositionForTask - [`3f4bdf2`](https://github.com/go-vikunja/vikunja/commit/3f4bdf2a254e7bfa7f9b2e6f00c3de02ff5ae5ea) fix: use local variable for position to avoid cross-view contamination ### 📊 Changes **1 file changed** (+5 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `pkg/models/task_position.go` (+5 -4) </details> ### 📄 Description calculateNewPositionForTask only checked for lowestPosition == 0 before triggering a full position recalculation. Extremely small position values (e.g. 3.16e-285) passed this check, causing new tasks to get meaningless positions via the index * 2^16 fallback, breaking sort order. Use the same < MinPositionSpacing threshold that createPositionsForTasksInView and the position update handler already use. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 18:04:38 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#8187