Closed
Bug 302650
Opened 19 years ago
Closed 19 years ago
Product.pm methods don't return what is expected, they are milestones, components and versions
Categories
(Bugzilla :: Bugzilla-General, defect)
Tracking
()
RESOLVED
FIXED
Bugzilla 2.22
People
(Reporter: gabriel.sales, Assigned: gabriel.sales)
References
Details
Attachments
(1 file, 4 obsolete files)
|
2.38 KB,
patch
|
LpSolit
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050608 Firefox/1.0 (Ubuntu package 1.0.4) Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050608 Firefox/1.0 (Ubuntu package 1.0.4) When i call a product method their methods ( milestones, components and versions) don't return what is expected. Reproducible: Always Steps to Reproduce: 1.Instance a product object. 2.Call for methods milestones, components and versions 3. Actual Results: don't return a hash. Expected Results: return a hash with the method's object
| Assignee | ||
Comment 3•19 years ago
|
||
Yes it's supposed to return an array, this attachment may fix the problem.
Attachment #191260 -
Flags: review?(LpSolit)
Updated•19 years ago
|
Assignee: general → gabriel
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 4•19 years ago
|
||
Comment on attachment 191260 [details] [diff] [review] v1-change hash_refs to arrays >Index: Bugzilla/Component.pm >- my $hash_ref = Bugzilla::Component::get_components_by_product(1); >+ my @array_ref = Bugzilla::Component::get_components_by_product(1); > my $component = $hash_ref->{1}; The "my $component = $hash_ref->{1};" line has to be removed as well. >Index: Bugzilla/Product.pm >- return $self->{versions}; >+ return $self->{versions} Oops, the semicolon has been removed by accident. You also have to update the POD accordingly in all the concerned files; timello forgot to update them. Replace '$hash_ref = ...' by '@array_ref = ...' as you did in this patch. Otherwise, your patch looks good.
Attachment #191260 -
Flags: review?(LpSolit) → review-
Updated•19 years ago
|
Status: NEW → ASSIGNED
OS: Linux → All
Hardware: PC → All
Target Milestone: --- → Bugzilla 2.22
Version: unspecified → 2.21
| Assignee | ||
Comment 5•19 years ago
|
||
I update the pod doc's to the new scenario.
Attachment #191260 -
Attachment is obsolete: true
Attachment #191997 -
Flags: review?(LpSolit)
Comment 6•19 years ago
|
||
You know, it's easy to turn a hash into an array, but difficult to turn an array into a hash. Maybe we should just be returning hashes everywhere, in case we need them. I can imagine situations where they would be useful. (For example, picking a component out of $product->components.)
| Assignee | ||
Comment 7•19 years ago
|
||
If the object has id, as components has, returns an hash else return a array of hashes cause in the case of versions and milestones if we use hashes the ids will be the values... What do you think about that??
Attachment #191997 -
Attachment is obsolete: true
Attachment #192233 -
Flags: review?(LpSolit)
| Assignee | ||
Updated•19 years ago
|
Attachment #192233 -
Flags: review?(mkanat)
Updated•19 years ago
|
Attachment #191997 -
Flags: review?(LpSolit)
Comment 8•19 years ago
|
||
Comment on attachment 192233 [details] [diff] [review] v3-changing plans WHy not just modify the get_x_by_product functions to return an array_ref, if you really want to change that? Also, it's not an array of hashes, but an array of objects. And don't disturb the spacing in the SYNOPSIS section. The = should be lined up.
Attachment #192233 -
Flags: review?(mkanat)
Attachment #192233 -
Flags: review?(LpSolit)
Attachment #192233 -
Flags: review-
| Assignee | ||
Comment 9•19 years ago
|
||
I changed the get_*_by_product and the Pod Doc's. Sorry about the Synopses on my last patch :(
Attachment #192233 -
Attachment is obsolete: true
Attachment #192370 -
Flags: review?(mkanat)
Comment 10•19 years ago
|
||
Comment on attachment 192370 [details] [diff] [review] v4-patch >Index: Bugzilla/Version.pm > foreach my $value (@$values) { > push @versions, new Bugzilla::Version($product_id, $value); > } >- return @versions; >+ return \@versions; > } editversions.cgi expects an array from get_versions_by_product() and we have a good reason to require an array, see all the work done by timello on editversions.cgi & co files (and by myself through reviews). Moreover, this doesn't make sense to modify Version.pm only. As long as we have no real needs for something else than arrays, please don't change values returned by these routines.
Attachment #192370 -
Flags: review?(mkanat) → review-
Comment 11•19 years ago
|
||
Also, before submitting a patch, please test it first! I needed less than 10 seconds to check that editversions.cgi is now broken due to your patch.
| Assignee | ||
Comment 12•19 years ago
|
||
I think the better place to do the changes is Product.pm, catch versions and milestones as arrays an pass an arrayref to the method. If i'm wrong please give me some light... :)
Attachment #192370 -
Attachment is obsolete: true
Attachment #193075 -
Flags: review?(mkanat)
| Assignee | ||
Updated•19 years ago
|
Attachment #193075 -
Flags: review?(LpSolit)
Comment 13•19 years ago
|
||
Comment on attachment 193075 [details] [diff] [review] v5-Product.pm fix >- Description: Returns a hash with of all product versions. >+ Description: Returns a array with of all product versions. >- Description: Returns a hash with of all product milestones. >+ Description: Returns a array with of all product milestones. Nit: "Gets all valid versions/milestones for that product" sounds better to me. r=LpSolit
Attachment #193075 -
Flags: review?(mkanat)
Attachment #193075 -
Flags: review?(LpSolit)
Attachment #193075 -
Flags: review+
Updated•19 years ago
|
Flags: approval?
Updated•19 years ago
|
Flags: approval? → approval+
Comment 14•19 years ago
|
||
Checking in Bugzilla/Product.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Product.pm,v <-- Product.pm new revision: 1.8; previous revision: 1.7 done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•