adamtornhill / maat-scripts

Scripts used to post-process the results from Code Maat
GNU General Public License v3.0
74 stars 30 forks source link

csv_as_enclosure_json.py is not calculating weight #6

Closed mauro2357 closed 6 years ago

mauro2357 commented 6 years ago

This was moved from https://github.com/adamtornhill/code-maat/issues/53

I am running the python script csv_as_enclosure_json.py and the json is always generated with 0 in the weight attribute.

In debug mode the function normalized_weight_for is not executing "if module_name in normalized_weights:"

These are my files

countlines-domina04012018.txt revisions-domina04012018.txt

And this is the way i execute the script

python csv_as_enclosure_json.py --structure "countlines-domina04012018.csv" --weights "revisions-domina04012018.csv" - weightcolumn 2 > jsond3Domina.json

mauro2357 commented 6 years ago

In response to.

"This script is not part of code-maat. Is it the one that was referenced in my book? In that case, please check the recent revision of the script here: https://github.com/adamtornhill/maat-scripts

You should leave out the weightcolumn argument when invoking the script. We should also move the discussion to the maat-scripts repository if you have any follow up questions on the scripts."

I executed the script againleaving out the weightcolumn argument and the problem is the same. There is a strage behavior. the first 2 letters of the modules generated in the json are erased. See the this:

{"name": "root", "children": [{"name": "urces", "children": [{"name": "automatizacion"

The name generated by the script is "urces" but the real name is "sources" as you can see in the scripts:

revisions-domina04012018.txt countlines-domina04012018.txt

This is the generated json

jsond3Domina.txt

Thanks in advance.

adamtornhill commented 6 years ago

@mauro2357 Thanks for the detailed bug report. I managed to reproduce the problem and it was indeed a bug in the Python script. I have pushed a new version on transform/csv_as_enclosure_json.py so please try again with this updated version and without the weightcolumn option.

adamtornhill commented 6 years ago

@mauro2357 Did my patch solve the problem you were reporting? Please let me know and I'll close the issue.

mauro2357 commented 6 years ago

Yes. Thanks