sigmah icon indicating copy to clipboard operation
sigmah copied to clipboard

0000635: Indicators values not in order in long period project exports

Open manishvishnoi2 opened this issue 8 years ago • 8 comments

Fixes 0000635.

Attached example :

Project_synthesis_20160311224211.xls.zip

manishvishnoi2 avatar Mar 11 '16 17:03 manishvishnoi2

Hi @manishvishnoi2, thank you for this PR.

I am skeptical about the way you fixed the issue because you broke the immutability on the PivotTableData.Axis class. Can you try again to fix the issue, keeping the class immutable (keeping the setter declared private)?

You will have to pass label parameter to the Axis constructor, so you will have to find where the Axis is instantiated earlier in the generation process.

ghost avatar Mar 22 '16 17:03 ghost

@numero-six Hello sir,I will look at the code again and try to fix this.

manishvishnoi2 avatar Mar 22 '16 17:03 manishvishnoi2

@numero-six Plz look at the latest fix.It is done by working on Axis class creating a new function thus not breaking immutability.

manishvishnoi2 avatar Mar 25 '16 15:03 manishvishnoi2

@manishvishnoi2 your second commit has the same problem, immutability is still broken. You just added another setter.

You should try to solve the problem just like if the label field was declared final. You will see that your only way become to change the label by passing it to the existing Axis constructor with 4 parameters. If you do a find usages in your IDE, you may find that the constructor is called only by PivotTableData.Axis#addChild and I guess that you have to find the call to addChild that should be fixed.

I see that one of them is in org.sigmah.server.report.model.generator.PivotGenerator.Populator#addMonths add that method compute a label by calling a method renderMonthLabel. I don't know if it is the exact place to fix but in my opinion but the fix should occur somewhere around there. It would make more sense that the Populator would be modified and the Axis not.

Please, look at the issue again, there should be a way.

ghost avatar Apr 04 '16 14:04 ghost

@manishvishnoi2 : Just checking if you had time to fix the issue with the immutability on the PivotTableData.Axis class, as pointed out by @numero-six

spMohanty avatar Apr 10 '16 07:04 spMohanty

@spMohanty Yes i am working on it.I will look at reduntant spaces and indentation.

manishvishnoi2 avatar Apr 10 '16 07:04 manishvishnoi2

@numero-six Hello sir, I looked at the problem again.I found out that populator is just filling by applying all the label parameter.Also, rather than using a constructor which has other parameters also , i think using a new method as i did is better.The reason i modified axis is because, to populate cells its using Month-Name string which repeats every 12th time.So we have to change the label which cannot be done at populator but at axis. To my thoughts my method is best suitable but if you feel otherwise one more method i can suggest is to make a new constructor with only label parameter.

manishvishnoi2 avatar Apr 16 '16 19:04 manishvishnoi2

Yeah, if you remove the setter and add a constructor with a label parameter, it would be a better option.

ghost avatar Apr 20 '16 14:04 ghost