Monocle icon indicating copy to clipboard operation
Monocle copied to clipboard

Add CP and Level to db, webhook, and frontend

Open tallypokemap opened this issue 7 years ago • 15 comments

CP and Pokemon Level are as useful as IV in that if you level 30 accounts they are nice to report. Since we are reporting IV, it makes sense to report CP and Level as well. Credit to Asner who's code helped me add CP.

tallypokemap avatar Jun 01 '17 19:06 tallypokemap

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/local/lib/python3.5/dist-packages/MySQLdb/cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python3.5/dist-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
    raise errorvalue
  File "/usr/local/lib/python3.5/dist-packages/MySQLdb/cursors.py", line 247, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.5/dist-packages/MySQLdb/cursors.py", line 411, in _query
    rowcount = self._do_query(q)
  File "/usr/local/lib/python3.5/dist-packages/MySQLdb/cursors.py", line 374, in _do_query
    db.query(q)
  File "/usr/local/lib/python3.5/dist-packages/MySQLdb/connections.py", line 292, in query
    _mysql.connection.query(self, query)
_mysql_exceptions.OperationalError: (1054, "Unknown column 'mystery_sightings.cp' in 'field list'")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/nmc/github/monocle/monocle/db_proc.py", line 46, in run
    db.add_mystery(session, item)
  File "/home/nmc/github/monocle/monocle/db.py", line 441, in add_mystery
    .filter(Mystery.spawn_id == pokemon['spawn_id']) \
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/query.py", line 2755, in first
    ret = list(self[0:1])
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/query.py", line 2547, in __getitem__
    return list(res)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/query.py", line 2855, in __iter__
    return self._execute_and_instances(context)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/query.py", line 2878, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/local/lib/python3.5/dist-packages/MySQLdb/cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python3.5/dist-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
    raise errorvalue
  File "/usr/local/lib/python3.5/dist-packages/MySQLdb/cursors.py", line 247, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.5/dist-packages/MySQLdb/cursors.py", line 411, in _query
    rowcount = self._do_query(q)
  File "/usr/local/lib/python3.5/dist-packages/MySQLdb/cursors.py", line 374, in _do_query
    db.query(q)
  File "/usr/local/lib/python3.5/dist-packages/MySQLdb/connections.py", line 292, in query
    _mysql.connection.query(self, query)
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1054, "Unknown column 'mystery_sightings.cp' in 'field list'") [SQL: 'SELECT mystery_sightings.id AS mystery_sightings_id, mystery_sightings.pokemon_id AS mystery_sightings_pokemon_id, mystery_sightings.spawn_id AS mystery_sightings_spawn_id, mystery_sightings.encounter_id AS mystery_sightings_encounter_id, mystery_sightings.lat AS mystery_sightings_lat, mystery_sightings.lon AS mystery_sightings_lon, mystery_sightings.first_seen AS mystery_sightings_first_seen, mystery_sightings.first_seconds AS mystery_sightings_first_seconds, mystery_sightings.last_seconds AS mystery_sightings_last_seconds, mystery_sightings.seen_range AS mystery_sightings_seen_range, mystery_sightings.atk_iv AS mystery_sightings_atk_iv, mystery_sightings.def_iv AS mystery_sightings_def_iv, mystery_sightings.sta_iv AS mystery_sightings_sta_iv, mystery_sightings.move_1 AS mystery_sightings_move_1, mystery_sightings.move_2 AS mystery_sightings_move_2, mystery_sightings.cp AS mystery_sightings_cp, mystery_sightings.cp_multiplier AS mystery_sightings_cp_multiplier \nFROM mystery_sightings \nWHERE mystery_sightings.encounter_id = %s AND mystery_sightings.spawn_id = %s \n LIMIT %s'] [parameters: (11998290704452769133, 8848365737923, 1)]```

nickmhc avatar Jun 04 '17 03:06 nickmhc

mysql migration, add this 2 column manually to mystery_sightings, sightings @nickmhc

 +    cp = Column(SmallInteger)
 +    cp_multiplier = Column(FLOAT_TYPE)

walaoaaa1234 avatar Jun 04 '17 03:06 walaoaaa1234

I need someone to use the map and make a report bot with showing cp iv and moveset I am paying for it Need it for discord Message if anyone can do it

tejas0029 avatar Jun 05 '17 09:06 tejas0029

Hello i am looking for a developer to prepare discord coordinate bot. You seem experienced and well known, i pay for work Reply if interested

tejas0029 avatar Jun 06 '17 18:06 tejas0029

Hello i am looking for a developer to prepare discord coordinate bot. You seem experienced and well known, i pay for work Reply if interested Mail--- [email protected]

tejas0029 avatar Jun 06 '17 18:06 tejas0029

Can this be approved? Thanks

jesshub avatar Jun 11 '17 09:06 jesshub

@tallypokemap it would be awesome if you could also include height and weight and form for unowns into the db so it could be shown on the map and in the webhook. this is helpful for getting the Fisherman and Youngster badges :-)

Bart274 avatar Jun 15 '17 08:06 Bart274

@Bart274 that shouldn't be done as a column each, as it only needs more resources - I think we need a extra_details column or so besides that it should go in an own PR

evenly-epic-mule avatar Jun 15 '17 11:06 evenly-epic-mule

@tallypokemap besides the requested changes it would be nice if you'd merge the commits together

evenly-epic-mule avatar Jun 15 '17 11:06 evenly-epic-mule

For those updating from a previous version: mysql migration, delete this column from mystery_sightings, sightings

  • cp_multiplier = Column(FLOAT_TYPE)

and replace with

  • level = Column(SmallInteger)

tallypokemap avatar Jun 17 '17 22:06 tallypokemap

How far is this to be merged ? Just tried it and aint working

just2codes avatar Jun 30 '17 14:06 just2codes

I just tried this and it doesn't work for level information anymore

nickmhc avatar Jul 11 '17 16:07 nickmhc

Workers, but dont display the correct cp and level of pokemons @tallypokemap

M3G4THEKING avatar Jul 14 '17 14:07 M3G4THEKING

@nickmhc You might need to check your logs to see what is going on. I still have level working just fine on my map. @m3g4mInD You will need Level 30 workers for it to show the correct stats for a level 30 player. Everything below level 30 is randomized.

tallypokemap avatar Jul 14 '17 22:07 tallypokemap

@tallypokemap yeap i use all accts lv 30+, but still have this issue.i have verifie all accts, all accts detect larvitar and snorlax, they dont are sb or warnings Update: Now all works fine,thanks

M3G4THEKING avatar Jul 14 '17 22:07 M3G4THEKING