Sometimes the best features are the simplest.
The Challenge
Add task priority levels (high/medium/low) with filtering, sorting, and statistics.
Time constraint: Only 1 hour available today.
Result: Fully implemented in 70 minutes!
Why Priorities Matter
User problem: "All my tasks look the same. Which should I do first?"
Solution: Let users mark priority levels.
Impact:
- Focus on high priority first
- Filter out low priority noise
- See if too many tasks marked urgent (priority inflation)
Implementation (15 Lines of Code)
1. Add Enum
class PriorityEnum(str, Enum):
low = "low"
medium = "medium"
high = "high"
2. Add Column
priority = Column(String(10), default="medium", index=True)
3. Update Schemas
priority: Optional[PriorityEnum] = Field(default=PriorityEnum.medium)
4. Add Filter
if priority:
query = query.filter(Task.priority == priority)
5. Update Stats
"by_priority": {
"high": tasks.filter(Task.priority == "high").count(),
"medium": tasks.filter(Task.priority == "medium").count(),
"low": tasks.filter(Task.priority == "low").count()
}
Done!
Query examples:
GET /tasks?priority=high
GET /tasks?priority=high&completed=false
GET /tasks?sort_by=priority&order=desc
Key Takeaways
✅ Enums prevent typos (no "hgh" or "medum")
✅ Defaults prevent decision fatigue
✅ Indexes make filtering fast
✅ Simple features can have big impact
Time: 1 hour
Lines changed: ~15
User value: Immediate
Sometimes less IS more!
Day 6/100 complete! ✅
Following my journey?
📝 Blog | 🐦 Twitter | 💼 LinkedIn
Top comments (0)