Closed Bug 308663 Opened 19 years ago Closed 16 years ago

Cryptic "'' is not a legal date" error from time summaries (missing start date when splitting results by month)

Categories

(Bugzilla :: Bugzilla-General, defect)

2.20
defect
Not set
minor

Tracking

()

RESOLVED FIXED
Bugzilla 3.4

People

(Reporter: wicked, Assigned: selsky)

Details

Attachments

(1 file, 1 obsolete file)

Summarize_time.cgi says |'' is not a legal date.| when Split by month is
selected but period start date field is left empty. User error is thrown from
line 434 which is commented as follows:

# unfortunately it's not too easy to guess a start date, since
# it depends on what bugs we're looking at. We risk bothering
# the user here. XXX: perhaps run a query to see what the
# earliest activity in longdescs for all bugs and use that as a
# start date.

Best fix would be use some default start date just like we do with any other
combination of options. Failing that, the error message should atleast be
enhanced to say what the actual reason is. There's no way an user knows what
went wrong with that kind of error message..
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch Guess a start date (obsolete) — Splinter Review
Guess a starting date by using the 1st day of the 1st month with bug activity.
Attachment #362469 - Flags: review?
Attachment #362469 - Flags: review? → review?(LpSolit)
Comment on attachment 362469 [details] [diff] [review]
Guess a start date

>+    my $times = $dbh->selectcol_arrayref(
>+        "SELECT MIN(bug_when)
>+           FROM longdescs
>+          WHERE bug_id IN ($buglist)
>+            AND work_time > 0");
>+
>+    my $time = str2time(shift @{$times});
>+    return format_time(scalar localtime($time), '%Y-%m-01');


You must use $dbh->sql_in('bug_id', $bugids) instead of the hardcoded "IN ($buglist)" due to a limitation in Oracle.
Also, I think the DB server should format the output itself, using $dbh->sql_date_format(), as it may return a string which is not parsable by str2time(). Not sure you can combine it with MIN(bug_when), you will have to test. Also, to avoid this "shift" hack, use $dbh->selectrow_array() instead; it's cleaner. Otherwise looks good.
Attachment #362469 - Flags: review?(LpSolit) → review-
Assignee: general → selsky
Tested on MySQL 5.0.x
Attachment #362469 - Attachment is obsolete: true
Attachment #372253 - Flags: review?(LpSolit)
Attachment #372253 - Flags: review?(LpSolit) → review+
Comment on attachment 372253 [details] [diff] [review]
 Guess a start date v2

Tested successfully with MySQL 5.0.67 and PostgreSQL 8.3.7. Thanks for the patch! r=LpSolit
Status: NEW → ASSIGNED
Flags: approval3.4+
Flags: approval+
Target Milestone: --- → Bugzilla 3.4
tip:

Checking in summarize_time.cgi;
/cvsroot/mozilla/webtools/bugzilla/summarize_time.cgi,v  <--  summarize_time.cgi
new revision: 1.25; previous revision: 1.24
done

3.3.4:

Checking in summarize_time.cgi;
/cvsroot/mozilla/webtools/bugzilla/summarize_time.cgi,v  <--  summarize_time.cgi
new revision: 1.24.2.1; previous revision: 1.24
done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Keywords: relnote
Resolution: --- → FIXED
Summary: Cryptic '' is not a legal date error from time summaries → Cryptic "'' is not a legal date" error from time summaries (missing start date when splitting results by month)
Keywords: relnote
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: