Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clan member sync broken by API changes #55

Closed
biurokomplex opened this issue Sep 9, 2015 · 10 comments
Closed

Fix clan member sync broken by API changes #55

biurokomplex opened this issue Sep 9, 2015 · 10 comments

Comments

@biurokomplex
Copy link

Hello, i update this two files and sync finish without errors right now, but the clan members list on site doesn't open.

jinja2.exceptions.UndefinedError
UndefinedError: 'dict object' has no attribute u'executive_officer'

Traceback (most recent call last)
File "C:\Python27\lib\site-packages\flask\app.py", line 1836, in call
return self.wsgi_app(environ, start_response)
File "C:\Python27\lib\site-packages\flask\app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "C:\Python27\lib\site-packages\flask\app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Python27\lib\site-packages\flask\app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "C:\Python27\lib\site-packages\flask\app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Python27\lib\site-packages\flask\app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Python27\lib\site-packages\flask\app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Python27\lib\site-packages\flask\app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "C:\Users\user\Desktop\whyattend\whyattend\webapp.py", line 152, in decorated_function
return f(args, *kwargs)
File "C:\Users\user\Desktop\whyattend\whyattend\webapp.py", line 1187, in clan_players
last_battle_by_player=last_battle_by_player)
File "C:\Python27\lib\site-packages\flask\templating.py", line 128, in render_template
context, ctx.app)
File "C:\Python27\lib\site-packages\flask\templating.py", line 110, in _render
rv = template.render(context)
File "C:\Python27\lib\site-packages\jinja2\environment.py", line 969, in render
return self.environment.handle_exception(exc_info, True)
File "C:\Python27\lib\site-packages\jinja2\environment.py", line 742, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\user\Desktop\whyattend\whyattend\templates\players\players.html", line 1, in top-level template code
{% extends "layout.html" %}
File "C:\Users\user\Desktop\whyattend\whyattend\templates\layout.html", line 163, in top-level template code
{% block content %}{% endblock %}
File "C:\Users\user\Desktop\whyattend\whyattend\templates\players\players.html", line 70, in block "content"
{{g.roles[player.role]}}
File "C:\Python27\lib\site-packages\markupsafe_native.py", line 22, in escape
return Markup(text_type(s)
UndefinedError: 'dict object' has no attribute u'executive_officer'

And another thing is that the "payment" doesn't show in template.
Do you have any clues?

ceari added a commit that referenced this issue Sep 9, 2015
@ceari
Copy link
Owner

ceari commented Sep 9, 2015

Hi, I added the missing role "executive_officer" to the configuration. If you are using a custom local_config.py make sure to update it (see config.py)

With "payment" you mean the "Gold paid out so far" column in the players table? That's not implemented yet unfortunately: #2

@biurokomplex
Copy link
Author

Thanks for answer, i add this to config, but to make it work i must add too:
'combat_officer': 'combat_officer',
'intelligence_officer': 'intelligence_officer',

Now the clan members show but i stiil dont have a payment (not the "Gold paid out so far") just standard calculator to spend gold...

@enbewu
Copy link

enbewu commented Sep 10, 2015

Furthermore:

ERROR:whyattend.webapp:Exception on /sync-players/ [GET]
Traceback (most recent call last):
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/cwtracker/cw.psqd.co/cw.psycho/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/cwtracker/cw.psqd.co/whyattend/webapp.py", line 227, in sync_players
    player_ids = clan_info['data'][str(clan_id)]['members'].keys()
AttributeError: 'NoneType' object has no attribute 'keys'

@enbewu
Copy link

enbewu commented Sep 10, 2015

After some more issues, local_config.py should have:


    'leader': 'Commander',
    'vice_leader': 'Deputy Commander',
    'commander': 'Field Commander',
    'junior_officer': 'Junior Officer',
    'executive_officer': 'Executive Officer',
    'personnel_officer': 'Personnel Officer',
    'combat_officer': 'Combat Officer',
    'recruitment_officer': 'Recr. Officer',
    'intelligence_officer': 'Intelligence Officer',
    'reservist': 'Reservist',
    'recruiter': 'Recruiter',
    'private': 'Soldier',
    'recruit': 'Recruit',
    'treasurer': 'Treasurer',
    'diplomat': 'Diplomat',

BUT. WG seems to have changed the rank for Clan Leader and now it's called Commander, not Leader which messes up the in-app access rigths.

@enbewu
Copy link

enbewu commented Sep 12, 2015

To have the ability to pay out you need @biurokomplex to add the new roles to the PAYOUT_ROLE.

ceari added a commit that referenced this issue Sep 12, 2015
@ceari
Copy link
Owner

ceari commented Sep 12, 2015

Thanks for the info @enbewu

I've updated the defaults in config.py according to https://api.worldoftanks.eu/wgn/clans/glossary/?application_id=demo - it seems the role names changed quite a bit. Let me know if there are roles missing.

@Gucioo
Copy link
Contributor

Gucioo commented Sep 13, 2015

You missed Junior Officer, in local_config.py should be:

ROLE_LABELS = {
    "personnel_officer": "Personnel Officer",
    "quartermaster": "Quartermaster",
    "executive_officer": "Executive Officer",
    "recruit": "Recruit",
    "private": "Private",
    "commander": "Commander",
    "reservist": "Reservist",
    "combat_officer": "Combat Officer",
    "recruitment_officer": "Recruitment Officer",
    "intelligence_officer": "Intelligence Officer",
    "junior_officer": "Junior Officer"
}

Sync and players list working fine with that.

@enbewu - theres no longer used leader, vice leader, treasurer... and new roles need to be updated, so you can simply delete old ones.

@biurokomplex
Copy link
Author

Hi, all and thanks for help, now all work fine. I have one more question about "profile" when you are login, when you click on your nick and click on "profile" that happend:
KeyError
KeyError: 0

Traceback (most recent call last)
File "C:\Python27\lib\site-packages\flask\app.py", line 1836, in call
return self.wsgi_app(environ, start_response)
File "C:\Python27\lib\site-packages\flask\app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "C:\Python27\lib\site-packages\flask\app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Python27\lib\site-packages\flask\app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "C:\Python27\lib\site-packages\flask\app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Python27\lib\site-packages\flask\app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Python27\lib\site-packages\flask\app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Python27\lib\site-packages\flask\app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "C:\Users\user\Desktop\whyattend\whyattend\webapp.py", line 152, in decorated_function
return f(_args, *_kwargs)
File "C:\Users\user\Desktop\whyattend\whyattend\webapp.py", line 1837, in profile
performance = analysis.player_performance(played_battles, [g.player])
File "C:\Users\user\Desktop\whyattend\whyattend\analysis.py", line 42, in player_performance
replay_data['second'][0]['players'])
File "C:\Users\user\Desktop\whyattend\whyattend\replays.py", line 163, in player_performance
v = v[0]
KeyError: 0

Do you have the same error? if yes, please give me the clue how to fix it.
Thanks again for all...

@ceari
Copy link
Owner

ceari commented Sep 14, 2015

I implemented some fixes regarding handling of older replay versions that lead to this error. Please try it now.

@biurokomplex
Copy link
Author

All work fine now. Scheduled Battles, Provinces owned and profiles too. Thanks for help and we can close this topic ;) bye

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants