Closed Bug 375631 Opened 13 years ago Closed 12 years ago

New TASK column: Days to Due

Categories

(Calendar :: Tasks, enhancement)

enhancement
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ben, Assigned: fred.jen)

References

Details

Attachments

(3 files, 3 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Build Identifier: 

On the left tasks pane, please add a column for Days until Due. It would count the days until the task is due: 1 day, 2 days, 3 days.  Very simple calculated column and very useful.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
There already is a sortable column showing the Due date in the task list. Adding another column just for showing the difference Due date - today seems redundant for me. In my opinion this might be solved by an Extension.
I would use the "Days until Due" column for tasks.  That would be nicer than having to manually think about (1) When is it due, (2) what's today's date, and (3) how many days are there between the two dates, especially if the due date is next month or after.  One nice thing about the proposed Today Pane is that we only have to show the columns that we want to see, so I would hide the Due Date column.
I see the use for a days until due column, although I'd be fine with an extension. Shouldn't be too hard, I'd say. I think its ok to have a such column defaulting to be hidden.

Christian, what do you say? This bug does not technically require UI, but it does require a UI descision, setting uiwanted.
Keywords: uiwanted
> I think its ok to have a such column defaulting to be hidden.

I support this idea. It should be hidden by default, and placed between "Due" and "Completed"
I am sorry I have no idea how it was possible to overlook this bug 3 times.
Attachment #328742 - Flags: review?(Berend.Cornelius)
Attached image The UI
Attachment #328743 - Flags: ui-review?(christian.jansen)
Duplicate of this bug: 444349
Assignee: nobody → fred.jen
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: uiwanted
OS: Windows Vista → All
Hardware: PC → All
Status: NEW → ASSIGNED
patch looks good and works fine. Thank you!

+            var dur = aTask.dueDate.subtractDate(now());
+            if (!dur.isNegative) {
+            if (dur.days > 1) {
+                return dur.days+ " " + calGetString("calendar", "days");

Just take care of your indentation and wrap spaces around your operators.
@Christian: we should take care to check in this issue before string-freeze next week
One last thing that I have noticed and looks awkward:

>                   case "calendar-task-tree-col-completed":
>                   case "calendar-task-tree-col-priority":
>+                  case "calendar-task-tree-col-duration":
>+                    return this.binding.duration(task);
>                   default:
>                       return "";

According to this code you want the cellText to be set by "duration" for the completed column and the priority column, too. It does not seem to harm, but shouldn't remain like this.
Comment on attachment 328742 [details] [diff] [review]
Duration with localizable strings

>+<!ENTITY calendar.unifinder.tree.duration.label      "Duration">

The new column doesn't show the tasks real duration. Instead it shows the duration from now to the due date. Maybe call it "Duration until Due"?

How does the new column behaves during sorting? Does it just sort alphabetically (1 day, 1 hour, 2 days) or by duration itself (1 hour, 1 day, 2 days).
Attached patch The patch (obsolete) — Splinter Review
I changed the comments of Berend and I put the col at the position proposed in the preciding comments.
Attachment #328742 - Attachment is obsolete: true
Attachment #328869 - Flags: review?(Berend.Cornelius)
Attachment #328742 - Flags: review?(Berend.Cornelius)
> The new column doesn't show the tasks real duration. Instead it shows the
> duration from now to the due date. Maybe call it "Duration until Due"?

+1, but I'd like to wait for Christian's opinion

> How does the new column behaves during sorting? Does it just sort
> alphabetically (1 day, 1 hour, 2 days) or by duration itself (1 hour, 1 day, 2
> days).

I just forgot it, i implemented it now. And it sorts by the duedate. I'll wait for more comments before sending in the patch.
It's hard to think of a better phrase than "Duration until Due".  However, there are also a couple of shorter phrases:  "Remaining" or "Due In".  I think that all three work well in English.
+1 for "Due in"
(In reply to comment #14)
> +1 for "Due in"
> 

"Due in" is ok for me. Pretty short :-) ui=christian
Attachment #328743 - Flags: ui-review?(christian.jansen) → ui-review+
Comment on attachment 328869 [details] [diff] [review]
The patch

patch looks good except for some minor style nits. FYI, we have a style guide on http://wiki.mozilla.org/Calendar:Style_Guide
If you don't mind, I can check in this patch with the new resource as discussed.
Attachment #328869 - Flags: review?(Berend.Cornelius) → review+
Would be a honor to me, if my first patch for the mozilla project would be checked in :)
Attached patch The patchSplinter Review
- you can sort the column
- Duration -> Due in
- "Due in" column is after the "Due" column
- the celltext isn't set for the priority and completed column (I hope so)
Attachment #328869 - Attachment is obsolete: true
Nice Job!
 There was one last bug that I noticed:
+          if (aTask && aTask.dueDate.isValid){

must be 
+          if (aTask && aTask.dueDate && aTask.dueDate.isValid){


I corrected that.
Patch checked in on trunk and MOZILLA_1_8_BRANCH
->FIXED
Thanks a lot for your contribution
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
If the duration is below one hour it displays "< 1Hour". I'd recommend to add a blank character for better reading as in "< 1 hour" or "<1 hour". In addition I think the units "Hour(s)" and "Day(s)" should be lower case in English. (I'm not a native speaker therefore correct me if I'm wrong.)

Attached patch Whitespace in "< 1 hour" (obsolete) — Splinter Review
Sorry for taking away your patch, but I think we should go a step further and allow localizations to specify how things are formatted. Maybe there are languages where it doesn't make sense to have the number first, or even "< 1" first.
Attachment #329331 - Attachment is obsolete: true
Attachment #329438 - Flags: review?(fred.jen)
Attachment #329438 - Flags: review?(fred.jen) → review+
Attachment #329438 - Attachment description: Allow better localization → [checked in] Allow better localization
Target Milestone: --- → 0.9
You need to log in before you can comment on or make changes to this bug.