TYPO in CategoryTree.groovy, lot's of un-used/un-wanted variables and un-clean & really hard to understand code
--------------------------------------------------------------------------------------------------------------- Key: OFBIZ-4375 URL: https://issues.apache.org/jira/browse/OFBIZ-4375 Project: OFBiz Issue Type: Bug Components: product Reporter: Atul Vani Fix For: Release Branch 11.04, SVN trunk TYPO in CategoryTree.groovy: <<prodCatalogMap.put("isCategoryType", true);>> should be <<prodCatalogMap2.put("isCategoryType", true);>> lot's of un-used/un-wanted variables: i, prodCatalogTree2, prodCatalogCategories, prodCatalog, prodCatalogId un-clean and really hard to understand code. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
[ https://issues.apache.org/jira/browse/OFBIZ-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Atul Vani updated OFBIZ-4375: ----------------------------- Attachment: OFBIZ-4375.patch > TYPO in CategoryTree.groovy, lot's of un-used/un-wanted variables and un-clean & really hard to understand code > --------------------------------------------------------------------------------------------------------------- > > Key: OFBIZ-4375 > URL: https://issues.apache.org/jira/browse/OFBIZ-4375 > Project: OFBiz > Issue Type: Bug > Components: product > Reporter: Atul Vani > Fix For: Release Branch 11.04, SVN trunk > > Attachments: OFBIZ-4375.patch > > > TYPO in CategoryTree.groovy: > <<prodCatalogMap.put("isCategoryType", true);>> should be <<prodCatalogMap2.put("isCategoryType", true);>> > lot's of un-used/un-wanted variables: > i, prodCatalogTree2, prodCatalogCategories, prodCatalog, prodCatalogId > un-clean and really hard to understand code. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Atul Vani updated OFBIZ-4375: ----------------------------- Attachment: OFBIZ-4375.patch > TYPO in CategoryTree.groovy, lot's of un-used/un-wanted variables and un-clean & really hard to understand code > --------------------------------------------------------------------------------------------------------------- > > Key: OFBIZ-4375 > URL: https://issues.apache.org/jira/browse/OFBIZ-4375 > Project: OFBiz > Issue Type: Bug > Components: product > Reporter: Atul Vani > Fix For: Release Branch 11.04, SVN trunk > > Attachments: OFBIZ-4375.patch, OFBIZ-4375.patch > > > TYPO in CategoryTree.groovy: > <<prodCatalogMap.put("isCategoryType", true);>> should be <<prodCatalogMap2.put("isCategoryType", true);>> > lot's of un-used/un-wanted variables: > i, prodCatalogTree2, prodCatalogCategories, prodCatalog, prodCatalogId > un-clean and really hard to understand code. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13091875#comment-13091875 ] Atul Vani commented on OFBIZ-4375: ---------------------------------- I'm not sure how much people here care about cleaner and understandable code, so this patch might never get committed, but if it does get it'll inspire me more to do the good work. Two patches attached, latest one has got only the changes supposed to be committed, previous one has comments along with the changes to explain them. > TYPO in CategoryTree.groovy, lot's of un-used/un-wanted variables and un-clean & really hard to understand code > --------------------------------------------------------------------------------------------------------------- > > Key: OFBIZ-4375 > URL: https://issues.apache.org/jira/browse/OFBIZ-4375 > Project: OFBiz > Issue Type: Bug > Components: product > Reporter: Atul Vani > Fix For: Release Branch 11.04, SVN trunk > > Attachments: OFBIZ-4375.patch, OFBIZ-4375.patch > > > TYPO in CategoryTree.groovy: > <<prodCatalogMap.put("isCategoryType", true);>> should be <<prodCatalogMap2.put("isCategoryType", true);>> > lot's of un-used/un-wanted variables: > i, prodCatalogTree2, prodCatalogCategories, prodCatalog, prodCatalogId > un-clean and really hard to understand code. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jacques Le Roux reassigned OFBIZ-4375: -------------------------------------- Assignee: Jacques Le Roux > TYPO in CategoryTree.groovy, lot's of un-used/un-wanted variables and un-clean & really hard to understand code > --------------------------------------------------------------------------------------------------------------- > > Key: OFBIZ-4375 > URL: https://issues.apache.org/jira/browse/OFBIZ-4375 > Project: OFBiz > Issue Type: Bug > Components: product > Reporter: Atul Vani > Assignee: Jacques Le Roux > Fix For: Release Branch 11.04, SVN trunk > > Attachments: OFBIZ-4375.patch, OFBIZ-4375.patch > > > TYPO in CategoryTree.groovy: > <<prodCatalogMap.put("isCategoryType", true);>> should be <<prodCatalogMap2.put("isCategoryType", true);>> > lot's of un-used/un-wanted variables: > i, prodCatalogTree2, prodCatalogCategories, prodCatalog, prodCatalogId > un-clean and really hard to understand code. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13092434#comment-13092434 ] Jacques Le Roux commented on OFBIZ-4375: ---------------------------------------- Hi Atul, Good work, I only reviewed so far and must say I really appreciated the comments :) Some questions/remarks though: # why do you write + // prodCatalogMap should be prodCatalogMap2, it's a TYPO. Moreover we don't even need it, whatever isn't calatlog (isCatalog == false) is a category. + prodCatalogMap2.put("isCategoryType", true); ie, why not removing last line then? Did you check if it's used elsewhere and should not be replaced by another test? # As you noticed in + // Let's use prodCatalog.getString("prodCatalogId") instead of prodCatalog.prodCatalogId, to keep things consistant, will look into "which one is better" later it's actually Groovy, so everywhere you can use prodCatalog.prodCatalogId style of instead prodCatalog.getString("prodCatalogId") # So you can also write prodCatalogMap2.productCategoryId = productCat.productCategoryId; rather than prodCatalogMap2.put("productCategoryId", productCat.getString("productCategoryId")); This is called property notation in Groovy: http://groovy.codehaus.org/Collections#Collections-Maps. There are tons of examples OOTB HTH > TYPO in CategoryTree.groovy, lot's of un-used/un-wanted variables and un-clean & really hard to understand code > --------------------------------------------------------------------------------------------------------------- > > Key: OFBIZ-4375 > URL: https://issues.apache.org/jira/browse/OFBIZ-4375 > Project: OFBiz > Issue Type: Bug > Components: product > Reporter: Atul Vani > Assignee: Jacques Le Roux > Fix For: Release Branch 11.04, SVN trunk > > Attachments: OFBIZ-4375.patch, OFBIZ-4375.patch > > > TYPO in CategoryTree.groovy: > <<prodCatalogMap.put("isCategoryType", true);>> should be <<prodCatalogMap2.put("isCategoryType", true);>> > lot's of un-used/un-wanted variables: > i, prodCatalogTree2, prodCatalogCategories, prodCatalog, prodCatalogId > un-clean and really hard to understand code. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13092516#comment-13092516 ] Atul Vani commented on OFBIZ-4375: ---------------------------------- 1. // prodCatalogMap should be prodCatalogMap2, it's a TYPO. Moreover we don't even need it, whatever isn't calatlog (isCatalog == false) is a category. I wrote this, because it will require code changes in org.ofbiz.product.category.CategoryServices.getChildCategoryTree() method. This method is called using an ajax request when we browse the child categories. What I think about all this is that the getChildCategoryTree seem to be placed in the wrong file, IMO CategoryServices.java should contain only service implementation and methods used by them. Moreover, CatagoryTree.groovy can be modified in such a way that we won't even need getChildCategoryTree method in the first place. Using the JSON in such a way as it is done seem wrong too. If we wanna use JSON then we should use net.sf.json.JSONArray and net.sf.json.JSONObject. Then put the JSON data into a hidden input field or a JS variable (like it's previous done in OFBiz, -1 from me), and use the JS to extract it and process it. This is a much cleaner way and reduces dependencies between things. And at last, IMO we should use html_data instead of json_data with jsTree. After all, a cleaner, maintainable, easy to understand and modify code is all we want in the end :) I had plans to do these in second pass. Please let me know your opinion. 2. Yes, we should use the groovy style. Please modify the file accordingly before committing, thanks in advance :) I've started to learn groovy, so that I write more of a groovy code then java in a groovy file ;) 3. Thanks Jacques :) > TYPO in CategoryTree.groovy, lot's of un-used/un-wanted variables and un-clean & really hard to understand code > --------------------------------------------------------------------------------------------------------------- > > Key: OFBIZ-4375 > URL: https://issues.apache.org/jira/browse/OFBIZ-4375 > Project: OFBiz > Issue Type: Bug > Components: product > Reporter: Atul Vani > Assignee: Jacques Le Roux > Fix For: Release Branch 11.04, SVN trunk > > Attachments: OFBIZ-4375.patch, OFBIZ-4375.patch > > > TYPO in CategoryTree.groovy: > <<prodCatalogMap.put("isCategoryType", true);>> should be <<prodCatalogMap2.put("isCategoryType", true);>> > lot's of un-used/un-wanted variables: > i, prodCatalogTree2, prodCatalogCategories, prodCatalog, prodCatalogId > un-clean and really hard to understand code. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hans Bakker resolved OFBIZ-4375. -------------------------------- Resolution: Fixed Fix Version/s: (was: Release Branch 11.04) thank you for the contribution, this and more committed : revision 1162688 > TYPO in CategoryTree.groovy, lot's of un-used/un-wanted variables and un-clean & really hard to understand code > --------------------------------------------------------------------------------------------------------------- > > Key: OFBIZ-4375 > URL: https://issues.apache.org/jira/browse/OFBIZ-4375 > Project: OFBiz > Issue Type: Bug > Components: product > Reporter: Atul Vani > Assignee: Jacques Le Roux > Fix For: SVN trunk > > Attachments: OFBIZ-4375.patch, OFBIZ-4375.patch > > > TYPO in CategoryTree.groovy: > <<prodCatalogMap.put("isCategoryType", true);>> should be <<prodCatalogMap2.put("isCategoryType", true);>> > lot's of un-used/un-wanted variables: > i, prodCatalogTree2, prodCatalogCategories, prodCatalog, prodCatalogId > un-clean and really hard to understand code. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13092902#comment-13092902 ] Atul Vani commented on OFBIZ-4375: ---------------------------------- Thanks Hans. > TYPO in CategoryTree.groovy, lot's of un-used/un-wanted variables and un-clean & really hard to understand code > --------------------------------------------------------------------------------------------------------------- > > Key: OFBIZ-4375 > URL: https://issues.apache.org/jira/browse/OFBIZ-4375 > Project: OFBiz > Issue Type: Bug > Components: product > Reporter: Atul Vani > Assignee: Jacques Le Roux > Fix For: SVN trunk > > Attachments: OFBIZ-4375.patch, OFBIZ-4375.patch > > > TYPO in CategoryTree.groovy: > <<prodCatalogMap.put("isCategoryType", true);>> should be <<prodCatalogMap2.put("isCategoryType", true);>> > lot's of un-used/un-wanted variables: > i, prodCatalogTree2, prodCatalogCategories, prodCatalog, prodCatalogId > un-clean and really hard to understand code. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jacques Le Roux closed OFBIZ-4375. ---------------------------------- Assignee: Hans Bakker (was: Jacques Le Roux) > TYPO in CategoryTree.groovy, lot's of un-used/un-wanted variables and un-clean & really hard to understand code > --------------------------------------------------------------------------------------------------------------- > > Key: OFBIZ-4375 > URL: https://issues.apache.org/jira/browse/OFBIZ-4375 > Project: OFBiz > Issue Type: Bug > Components: product > Reporter: Atul Vani > Assignee: Hans Bakker > Fix For: SVN trunk > > Attachments: OFBIZ-4375.patch, OFBIZ-4375.patch > > > TYPO in CategoryTree.groovy: > <<prodCatalogMap.put("isCategoryType", true);>> should be <<prodCatalogMap2.put("isCategoryType", true);>> > lot's of un-used/un-wanted variables: > i, prodCatalogTree2, prodCatalogCategories, prodCatalog, prodCatalogId > un-clean and really hard to understand code. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
Free forum by Nabble | Edit this page |