adjusted task size and sorting so that larger tasks change the hidden effective due date and small tasks sort higher in smaller but linear way.

This commit is contained in:
2026-02-25 18:46:43 -06:00
parent 81b572422b
commit 476823394b
2 changed files with 39 additions and 16 deletions
+25 -11
View File
@@ -42,19 +42,33 @@ export const SHARE_RULES_COLLECTION = 'TasGrid_ShareRules';
export const BUCKETS_COLLECTION = 'buckets';
export const SIZE_OPTIONS = [
{ value: "10", label: "10 - Multiple Days" },
{ value: "9", label: "9 - More than a day" },
{ value: "8", label: "8 - One day" },
{ value: "7", label: "7 - Half a day" },
{ value: "6", label: "6 - Two hours" },
{ value: "5", label: "5 - One hour" },
{ value: "4", label: "4 - Forty-Five minutes" },
{ value: "3", label: "3 - Thirty minutes" },
{ value: "2", label: "2 - Fifteen minutes" },
{ value: "1", label: "1 - Five minutes" },
{ value: "0", label: "0 - Less than a minute" }
{ value: "10", label: "10 - Two weeks" },
{ value: "9", label: "9 - One week" },
{ value: "8", label: "8 - Three days" },
{ value: "7", label: "7 - Two days" },
{ value: "6", label: "6 - One day" },
{ value: "5", label: "5 - Half a day" },
{ value: "4", label: "4 - Two hours" },
{ value: "3", label: "3 - One hour" },
{ value: "2", label: "2 - Thirty minutes" },
{ value: "1", label: "1 - Fifteen minutes" },
{ value: "0", label: "0 - Five minutes" }
];
export const SIZE_HOURS: Record<number, number> = {
10: 336, // Two weeks
9: 168, // One week
8: 72, // Three days
7: 48, // Two days
6: 24, // One day
5: 12, // Half a day
4: 2, // Two hours
3: 1, // One hour
2: 0.5, // Thirty minutes
1: 0.25, // Fifteen minutes
0: 0.083 // Five minutes
};
export const STATUS_OPTIONS = [
{ value: "10", label: "10 - Complete" },
{ value: "9", label: "9" },
+14 -5
View File
@@ -2,7 +2,7 @@ import { createStore, reconcile } from "solid-js/store";
import { createSignal, createEffect, createRoot } from "solid-js";
import { pb } from "@/lib/pocketbase";
import { toast } from "solid-sonner";
import { TASGRID_COLLECTION, TAGS_COLLECTION, SHARE_RULES_COLLECTION, BUCKETS_COLLECTION, URGENCY_HOURS } from "@/lib/constants";
import { TASGRID_COLLECTION, TAGS_COLLECTION, SHARE_RULES_COLLECTION, BUCKETS_COLLECTION, URGENCY_HOURS, SIZE_HOURS } from "@/lib/constants";
const LIST_FIELDS = 'id,collectionId,collectionName,created,updated,title,startDate,dueDate,priority,status,completed,tags,user,size,recurrence,sharedWith,deletedAt';
@@ -370,7 +370,17 @@ export const calculateUrgencyFromDate = (dateStr: string): number => {
};
export const getCombinedScore = (task: Task): number => {
const urgencyScore = calculateUrgencyScore(task.dueDate);
// 1. Calculate an effective due date by subtracting size hours
const size = task.size ?? 5; // Default size 5
const sizeHours = SIZE_HOURS[size] ?? 12;
const dueTime = new Date(task.dueDate).getTime();
if (isNaN(dueTime)) return 0;
// effective due date = due date - size task time
const effectiveDueTime = dueTime - (sizeHours * 60 * 60 * 1000);
const effectiveDueDateStr = new Date(effectiveDueTime).toISOString();
const urgencyScore = calculateUrgencyScore(effectiveDueDateStr);
let baseScore = (task.priority * store.pWeight) + (urgencyScore * store.uWeight);
// Tag adjustments
@@ -385,9 +395,8 @@ export const getCombinedScore = (task: Task): number => {
});
}
// Size adjustment: (size - 5) * -0.4
// Small tasks (0-4) get a slight boost, large tasks (6-10) get a slight penalty
const sizeScore = ((task.size ?? 5) - 5) * -0.4;
// Size adjustment: linear scale from +1.9 (for size 0) to 0 (for size 10)
const sizeScore = (10 - size) * 0.19;
baseScore += sizeScore;
// Status adjustment: 0-9 -> 0.0-2.0 weight