diff options
author | Wushin <pasekei@gmail.com> | 2014-10-11 10:54:51 -0500 |
---|---|---|
committer | Wushin <pasekei@gmail.com> | 2014-10-11 10:54:51 -0500 |
commit | c3a245b4d4a4d6826b52f68d2e174b54c2be05ed (patch) | |
tree | 56dfda2b8f2ff27aa959cc43b9116a7ff949a9d4 | |
parent | 4d494f21474684590ae4e475fb0e0c0fcea47daf (diff) | |
parent | bcdc59583b7a109eced76fb50869b5ad47123895 (diff) | |
download | manamarket-c3a245b4d4a4d6826b52f68d2e174b54c2be05ed.tar.gz manamarket-c3a245b4d4a4d6826b52f68d2e174b54c2be05ed.tar.bz2 manamarket-c3a245b4d4a4d6826b52f68d2e174b54c2be05ed.tar.xz manamarket-c3a245b4d4a4d6826b52f68d2e174b54c2be05ed.zip |
Merge pull request #7 from Rawng/stats_fix
Closes #6.
-rw-r--r-- | stats/process_salelog/utils.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/stats/process_salelog/utils.py b/stats/process_salelog/utils.py index fd4e432..4c59f5f 100644 --- a/stats/process_salelog/utils.py +++ b/stats/process_salelog/utils.py @@ -49,15 +49,19 @@ class ItemDB: self.itemdb_file = ElementTree(file="../data/items.xml") for item in self.itemdb_file.getroot(): - if item.get('id') > 500: - item_struct = Item() - item_struct.name = item.get('name') - if item.get('weight'): - item_struct.weight = item.get('weight') - if item.get('type'): - item_struct.type = item.get('type') - item_struct.description = item.get('description') - self.item_names[int(item.get('id'))] = item_struct + if item.get('name'): + file2 = ElementTree(file="../" + item.get('name')) + for item2 in file2.getroot(): + if item2.get('name'): + file3 = ElementTree(file="../" + item2.get('name')) + for item3 in file3.getroot(): + item_struct = Item() + item_struct.name = item3.get('name') + item_struct.weight = int(item3.get('weight', 0)) + if item3.get('type'): + item_struct.type = item3.get('type') + item_struct.description = item3.get('description') + self.item_names[int(item3.get('id'))] = item_struct def getItem(self, item_id): return self.item_names[item_id] |