Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e5c8e42709 | |||
| 476823394b |
@@ -28,7 +28,7 @@ export const QuickEntry: Component = () => {
|
||||
const [tags, setTags] = createSignal<string[]>([]);
|
||||
const [description, setDescription] = createSignal("");
|
||||
const [editorInstance, setEditorInstance] = createSignal<any>(null);
|
||||
const [size, setSize] = createSignal<string>("5");
|
||||
const [size, setSize] = createSignal<string>("3");
|
||||
|
||||
// Autofill tags based on context when opening
|
||||
createEffect(() => {
|
||||
@@ -237,7 +237,7 @@ export const QuickEntry: Component = () => {
|
||||
setUrgency("");
|
||||
setTags([]);
|
||||
setDescription("");
|
||||
setSize("5");
|
||||
setSize("3");
|
||||
lastParsedTags = [];
|
||||
setDateString("");
|
||||
setIsOpen(false);
|
||||
|
||||
@@ -264,7 +264,7 @@ export const TaskDetail: Component<TaskDetailProps> = (props) => {
|
||||
<div class="flex items-center gap-1 group shrink-0">
|
||||
<span class="text-[0.625rem] uppercase font-bold tracking-wider text-muted-foreground/70 hidden sm:inline">Size</span>
|
||||
<Select<any>
|
||||
value={(props.task.size ?? 5).toString()}
|
||||
value={(props.task.size ?? 3).toString()}
|
||||
onChange={(val: any) => {
|
||||
const value = typeof val === 'object' ? val?.value : val;
|
||||
if (value) {
|
||||
@@ -282,7 +282,7 @@ export const TaskDetail: Component<TaskDetailProps> = (props) => {
|
||||
<div class="flex items-center gap-1 sm:gap-1.5 text-foreground font-medium truncate">
|
||||
<Gauge size={14} class="text-primary opacity-70 group-hover:opacity-100 transition-opacity shrink-0" />
|
||||
<span class="text-xs sm:text-sm truncate">
|
||||
{SIZE_OPTIONS.find(o => o.value === (props.task.size ?? 5).toString())?.label || props.task.size}
|
||||
{SIZE_OPTIONS.find(o => o.value === (props.task.size ?? 3).toString())?.label || props.task.size}
|
||||
</span>
|
||||
</div>
|
||||
</SelectTrigger>
|
||||
|
||||
+25
-11
@@ -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" },
|
||||
|
||||
+15
-6
@@ -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 ?? 3; // Default size 3
|
||||
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
|
||||
@@ -1134,7 +1143,7 @@ export const addTask = async (title: string, options?: { dueDate?: Date | string
|
||||
const priority = options?.priority ?? 5;
|
||||
const tags = options?.tags ?? ["work"];
|
||||
const content = options?.content ?? "";
|
||||
const size = options?.size ?? 5;
|
||||
const size = options?.size ?? 3;
|
||||
|
||||
const tempId = "temp-" + Date.now();
|
||||
const initialTask: Task = {
|
||||
|
||||
Reference in New Issue
Block a user