Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Palette's Journal

## 2024-05-22 - Missing Delete Confirmation
**Learning:** Destructive actions like "Delete" should always have a confirmation step to prevent accidental data loss. This is a critical safety feature.
**Action:** Add `onsubmit="return confirm('...')" ` to delete forms.

## 2024-05-22 - Form Accessibility
**Learning:** Relying on placeholders or default option text for form labels is bad for accessibility. Screen readers may not read them correctly, and placeholders disappear when typing.
**Action:** Use `<label>` elements or `aria-label` attributes for all form inputs.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Task Prioritizer DockerHub Push

on:
push:
branches: [main]
branches: [main,develop]

jobs:
build-and-publish:
Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,29 @@ Task priority uses a weighted formula that factors in criticality, effort, due d
- **Mandays weight**: 15
- **Urgency max**: 80
- **Overdue boost**: 100
- **Due date boosts**:
- 1 month left: +5
- 1 week left: +10
- 3 days left: +20
- 1 day left: +30

Urgency uses a reciprocal formula where tasks become more urgent as the due date approaches, and overdue tasks receive a fixed boost:

```
if days_left < 0:
urgency = OVERDUE_BOOST
else:
urgency = URGENCY_MAX / (1 + days_left)
time_boost = 0
if days_left <= 1:
time_boost = BOOST_1_DAY
elif days_left <= 3:
time_boost = BOOST_3_DAYS
elif days_left <= 7:
time_boost = BOOST_1_WEEK
elif days_left <= 30:
time_boost = BOOST_1_MONTH

urgency = URGENCY_MAX / (1 + days_left) + time_boost

score = (criticality * CRITICALITY_WEIGHT)
+ (EFFORT_WEIGHT / effort)
Expand Down
23 changes: 19 additions & 4 deletions src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,29 @@ function calculateTaskScore($task) {
$CRITICALITY_WEIGHT = 50;
$EFFORT_WEIGHT = 20;
$MANDAYS_WEIGHT = 15;
$URGENCY_MAX = 80; // Increased from 40
$URGENCY_MAX = 80; // Base urgency for due dates
$OVERDUE_BOOST = 100;

// Urgency calculation (reciprocal for non-overdue, fixed boost for overdue)
// Additional boosts when approaching the due date
$BOOST_1_MONTH = 5; // <= 30 days
$BOOST_1_WEEK = 10; // <= 7 days
$BOOST_3_DAYS = 20; // <= 3 days
$BOOST_1_DAY = 30; // <= 1 day

// Urgency calculation with stepped boosts as the due date approaches
if ($daysLeft < 0) {
$urgencyScore = $OVERDUE_BOOST;
} else {
$urgencyScore = $URGENCY_MAX / (1 + $daysLeft); // DaysLeft=0 gives 80, 1 gives 40, etc.
$urgencyScore = $URGENCY_MAX / (1 + $daysLeft);
if ($daysLeft <= 1) {
$urgencyScore += $BOOST_1_DAY;
} elseif ($daysLeft <= 3) {
$urgencyScore += $BOOST_3_DAYS;
} elseif ($daysLeft <= 7) {
$urgencyScore += $BOOST_1_WEEK;
} elseif ($daysLeft <= 30) {
$urgencyScore += $BOOST_1_MONTH;
}
}

$score = 0;
Expand Down Expand Up @@ -219,7 +234,7 @@ function calculateTaskScore($task) {
<strong>Time Left:</strong> <?= $daysLeftText ?><br>
<strong>Score:</strong> <?= calculateTaskScore($task) ?>
</p>
<form method="POST" class="d-inline">
<form method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this task?');">
<input type="hidden" name="task_id" value="<?= $task['id'] ?>">
<button type="submit" name="delete_task" class="btn btn-sm btn-outline-danger">Delete</button>
</form>
Expand Down