FAForever / faf-python-api

Deprecated python api - please go to faf-java-api for the current api!
https://github.com/FAForever/faf-java-api
GNU General Public License v3.0
3 stars 10 forks source link

maps/ladder1v1 returns bad values #96

Open yorick-ne opened 8 years ago

yorick-ne commented 8 years ago

api.faforever.com/maps/ladder1v1 returns a collection of maps in a valid format, but it seems to contain many maps that are not in the ladder pool and possibly no actual ladder maps.

I can have a closer look later, i guess there is just something wrong with the SQL.

Crotalus commented 8 years ago
SELECT features.rating AS `rating`, version.description AS `description`, version.width AS `width`,
version.max_players AS `max_players`, COALESCE(features.num_draws, 0) AS `num_draws`,
map.map_type AS `map_type`, COALESCE(features.downloads, 0) AS `downloads`,
version.height AS `height`, COALESCE(features.times_played, 0) AS `times_played`,
version.create_time AS `create_time`, SUBSTRING(version.filename, LOCATE('/', version.filename)+1, 
LOCATE('.zip', version.filename)-6) AS `technical_name`, map.display_name AS `display_name`,
l.login AS `author`, map.battle_type AS `battle_type`, REPLACE(REPLACE(version.filename, '.zip', '.png'),
'maps/', '') AS `thumbnail_url_small`, IF(version.ranked > 0, 'true', 'false') AS `ranked`,
version.filename AS `download_url`, REPLACE(REPLACE(version.filename, '.zip', '.png'),
'maps/', '') AS `thumbnail_url_large`, map.id AS `id`, version.version AS `version`
FROM ( map LEFT JOIN table_map_features features ON features.map_id = map.id
       JOIN map_version version ON version.map_id = map.id LEFT JOIN login l ON l.id = map.author )
JOIN ladder_map ON map.id = ladder_map.idmap
LIMIT 0, 1000

With the last JOIN-statement there on ladder_map I can't see how maps outside that table could be returned in this query.

(btw, weird that ladder_map has both id and idmap, should be enough to use the primary key as a foreign key to the map table)

yorick-ne commented 8 years ago

https://imgur.com/40mcLRU the map AI WARS 2 was returned for example, there were lots of similar maps returned as well. I havent heard anything of people getting "turtle"/AI maps in ladder, so i guess the ladder_map table itself is fine.