Closed Bug 253562 Opened 21 years ago Closed 21 years ago

Hours Worked (actual_time) is being listed as 1

Categories

(Bugzilla :: Bugzilla-General, defect, P2)

2.18
defect

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: kardel, Assigned: kiko)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (X11; U; NetBSD i386; en-US; rv:1.6) Gecko/20040209 Build Identifier: Mozilla/5.0 (X11; U; NetBSD i386; en-US; rv:1.6) Gecko/20040209 When enableing the time tracking option the Hours Worked field lists as 1 and that value also carries over into dependent fields. Environment contained perl 5.8.0, Bugzilla 2.18rc2 Reproducible: Always Steps to Reproduce: 1. enable time tracking (define respective group) 2. create a bug 3. look at Horus Worked - see a 1 without even working 4. attempt to collect cash from your employer - ok i am getting carried away... Actual Results: It happened at step 3 already. Expected Results: List 0.0 an empty Bug. The correct sum after times have been entered. The Problem is in Bugzilla/Bug.pm sub actual_time: Assignment to $self->{'actual_time'} is a scalar context. The result from &::FetchSQLData() is a one element array. Assignment will assign the 1 for the array size 8-(. Possible fix: my @result = &::FetchSQLData(); $self->{'actual_time'} = $result[0] if $#result >= 0;
Version: unspecified → 2.18
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking2.18?
Priority: -- → P2
Target Milestone: --- → Bugzilla 2.18
Why can't I reproduce this on my local system? I added: $self->{'actual_time'} = &::FetchSQLData(); print "OY". $self->{'actual_time'}; And I always get 0.00 back for bugs just created. This is Perl 5.6.1, MySQL 3.23.49 and DBI 1.37 and DBD::mysql v2.9002. Are you using something different? Anyway, it probably won't hurt to clarify that code a bit.
Assignee: justdave → kiko
Frank, can you please give this a try and see if it fixes your error? It may, but it may not given I'm not sure if fetchrow_array doesn't evaluate incorrectly in scalar context again (but that's done all over the tree). I'd really like to know why I can't reproduce this, but...
Attachment #154725 - Flags: review?(bugreport)
Comment on attachment 154725 [details] [diff] [review] kiko_v1: the usual bite-sized cleanup The cleanup looks fine, but I cant see it being cause and effect with this bug. I cannot reproduce this either. Let's start by figuring out if it is in the database wrong or in the UI wrong. Frank, please go into mysql and do a select * from londescs where bug_id = NUMBER and see if the actual work time field has any non-zero values in it.
Attachment #154725 - Flags: review?(bugreport)
(In reply to comment #2) > Created an attachment (id=154725) > kiko_v1: the usual bite-sized cleanup > > Frank, can you please give this a try and see if it fixes your error? It may, > but it may not given I'm not sure if fetchrow_array doesn't evaluate > incorrectly in scalar context again (but that's done all over the tree). > > I'd really like to know why I can't reproduce this, but... Well i am using perl 5.8.x maybe that is the difference ?
(In reply to comment #3) > ... > and see if the actual work time field has any non-zero values in it. > data looks nice either 0.00 or a sensible value is in the table Using fetch_arrayref in a scalar context (has element assignment) seems to be somewhat risky according to the DBI documentation: If called in a scalar context for a statement handle that has more than one column, it is undefined whether perl v5.8.0 2004-01-08 64 DBI(3) User Contributed Perl Documentation DBI(3) the driver will return the value of the first column or the last. So don't do that. Also, in a scalar con- text, an "undef" is returned if there are no more rows or if an error occurred. That "undef" can't be distin- guished from an "undef" returned because the first field value was NULL. For these reasons you should exercise some caution if you use "fetchrow_array" in a scalar context.
(In reply to comment #4) > Well i am using perl 5.8.x maybe that is the difference ? Maybe. Does the patch I provided fix things for you?
Status: NEW → ASSIGNED
(In reply to comment #6) > (In reply to comment #4) > > Well i am using perl 5.8.x maybe that is the difference ? > > Maybe. Does the patch I provided fix things for you? > Works - thanks !
Comment on attachment 154725 [details] [diff] [review] kiko_v1: the usual bite-sized cleanup Since it fixes his problems and doesn't regress us..
Attachment #154725 - Flags: review?(bugreport)
Comment on attachment 154725 [details] [diff] [review] kiko_v1: the usual bite-sized cleanup r=joel
Attachment #154725 - Flags: review?(bugreport) → review+
Flags: approval?
Flags: approval2.18?
Comment on attachment 154725 [details] [diff] [review] kiko_v1: the usual bite-sized cleanup This will probably work for 2.18, but didn't the API for Bugzilla::User just change on the trunk?
Flags: blocking2.18?
Flags: blocking2.18+
Flags: approval2.18?
Flags: approval2.18+
Flags: blocking2.18?
Flags: blocking2.18+
Flags: approval2.18?
Flags: approval2.18+
OS: NetBSD → All
Hardware: Other → All
ok, wth didn't that midair.... :)
Flags: blocking2.18?
Flags: blocking2.18+
Flags: approval2.18?
Flags: approval2.18+
Checked into HEAD: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v <-- Bug.pm new revision: 1.44; previous revision: 1.43 and branch: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v <-- Bug.pm new revision: 1.37.2.1; previous revision: 1.37 Thanks.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
clearing irrelevant approval request
Flags: approval?
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: