Updated maps to relate to new table.

This commit is contained in:
BurnyLlama 2023-04-16 13:54:34 +02:00
parent ec828c8465
commit 1821d5e482

View File

@ -22,49 +22,9 @@ impl Map {
sqlx::query_as!( sqlx::query_as!(
Map, Map,
" "
SELECT record_maps.map, category, points, stars, mappers, release, width, height, SELECT record_maps.map, category, points, stars, mappers, release, width, height, tiles
string_to_array(CONCAT_WS(',', FROM record_maps
CASE WHEN DEATH = '1' THEN 'DEATH' END, JOIN record_mapinfo_array ON record_maps.map = record_mapinfo_array.map;
CASE WHEN THROUGH = '1' THEN 'THROUGH' END,
CASE WHEN JUMP = '1' THEN 'JUMP' END,
CASE WHEN DFREEZE = '1' THEN 'DFREEZE' END,
CASE WHEN EHOOK_START = '1' THEN 'EHOOK_START' END,
CASE WHEN HIT_END = '1' THEN 'HIT_END' END,
CASE WHEN SOLO_START = '1' THEN 'SOLO_START' END,
CASE WHEN TELE_GUN = '1' THEN 'TELE_GUN' END,
CASE WHEN TELE_GRENADE = '1' THEN 'TELE_GRENADE' END,
CASE WHEN TELE_LASER = '1' THEN 'TELE_LASER' END,
CASE WHEN NPC_START = '1' THEN 'NPC_START' END,
CASE WHEN SUPER_START = '1' THEN 'SUPER_START' END,
CASE WHEN JETPACK_START = '1' THEN 'JETPACK_START' END,
CASE WHEN WALLJUMP = '1' THEN 'WALLJUMP' END,
CASE WHEN NPH_START = '1' THEN 'NPH_START' END,
CASE WHEN WEAPON_SHOTGUN = '1' THEN 'WEAPON_SHOTGUN' END,
CASE WHEN WEAPON_GRENADE = '1' THEN 'WEAPON_GRENADE' END,
CASE WHEN POWERUP_NINJA = '1' THEN 'POWERUP_NINJA' END,
CASE WHEN WEAPON_RIFLE = '1' THEN 'WEAPON_RIFLE' END,
CASE WHEN LASER_STOP = '1' THEN 'LASER_STOP' END,
CASE WHEN CRAZY_SHOTGUN = '1' THEN 'CRAZY_SHOTGUN' END,
CASE WHEN DRAGGER = '1' THEN 'DRAGGER' END,
CASE WHEN DOOR = '1' THEN 'DOOR' END,
CASE WHEN SWITCH_TIMED = '1' THEN 'SWITCH_TIMED' END,
CASE WHEN SWITCH = '1' THEN 'SWITCH' END,
CASE WHEN STOP = '1' THEN 'STOP' END,
CASE WHEN THROUGH_ALL = '1' THEN 'THROUGH_ALL' END,
CASE WHEN TUNE = '1' THEN 'TUNE' END,
CASE WHEN OLDLASER = '1' THEN 'OLDLASER' END,
CASE WHEN TELEINEVIL = '1' THEN 'TELEINEVIL' END,
CASE WHEN TELEIN = '1' THEN 'TELEIN' END,
CASE WHEN TELECHECK = '1' THEN 'TELECHECK' END,
CASE WHEN TELEINWEAPON = '1' THEN 'TELEINWEAPON' END,
CASE WHEN TELEINHOOK = '1' THEN 'TELEINHOOK' END,
CASE WHEN CHECKPOINT_FIRST = '1' THEN 'CHECKPOINT_FIRST' END,
CASE WHEN BONUS = '1' THEN 'BONUS' END,
CASE WHEN BOOST = '1' THEN 'BOOST' END,
CASE WHEN PLASMAF = '1' THEN 'PLASMAF' END,
CASE WHEN PLASMAE = '1' THEN 'PLASMAE' END,
CASE WHEN PLASMAU = '1' THEN 'PLASMAU' END), ',') AS tiles
FROM record_maps JOIN record_mapinfo ON record_maps.map = record_mapinfo.map;
" "
) )
.fetch_all(&db.pool) .fetch_all(&db.pool)
@ -75,49 +35,9 @@ impl Map {
sqlx::query_as!( sqlx::query_as!(
Map, Map,
" "
SELECT record_maps.map, category, points, stars, mappers, release, width, height, SELECT record_maps.map, category, points, stars, mappers, release, width, height, tiles
string_to_array(CONCAT_WS(',', FROM record_maps
CASE WHEN DEATH = '1' THEN 'DEATH' END, JOIN record_mapinfo_array ON record_maps.map = record_mapinfo_array.map
CASE WHEN THROUGH = '1' THEN 'THROUGH' END,
CASE WHEN JUMP = '1' THEN 'JUMP' END,
CASE WHEN DFREEZE = '1' THEN 'DFREEZE' END,
CASE WHEN EHOOK_START = '1' THEN 'EHOOK_START' END,
CASE WHEN HIT_END = '1' THEN 'HIT_END' END,
CASE WHEN SOLO_START = '1' THEN 'SOLO_START' END,
CASE WHEN TELE_GUN = '1' THEN 'TELE_GUN' END,
CASE WHEN TELE_GRENADE = '1' THEN 'TELE_GRENADE' END,
CASE WHEN TELE_LASER = '1' THEN 'TELE_LASER' END,
CASE WHEN NPC_START = '1' THEN 'NPC_START' END,
CASE WHEN SUPER_START = '1' THEN 'SUPER_START' END,
CASE WHEN JETPACK_START = '1' THEN 'JETPACK_START' END,
CASE WHEN WALLJUMP = '1' THEN 'WALLJUMP' END,
CASE WHEN NPH_START = '1' THEN 'NPH_START' END,
CASE WHEN WEAPON_SHOTGUN = '1' THEN 'WEAPON_SHOTGUN' END,
CASE WHEN WEAPON_GRENADE = '1' THEN 'WEAPON_GRENADE' END,
CASE WHEN POWERUP_NINJA = '1' THEN 'POWERUP_NINJA' END,
CASE WHEN WEAPON_RIFLE = '1' THEN 'WEAPON_RIFLE' END,
CASE WHEN LASER_STOP = '1' THEN 'LASER_STOP' END,
CASE WHEN CRAZY_SHOTGUN = '1' THEN 'CRAZY_SHOTGUN' END,
CASE WHEN DRAGGER = '1' THEN 'DRAGGER' END,
CASE WHEN DOOR = '1' THEN 'DOOR' END,
CASE WHEN SWITCH_TIMED = '1' THEN 'SWITCH_TIMED' END,
CASE WHEN SWITCH = '1' THEN 'SWITCH' END,
CASE WHEN STOP = '1' THEN 'STOP' END,
CASE WHEN THROUGH_ALL = '1' THEN 'THROUGH_ALL' END,
CASE WHEN TUNE = '1' THEN 'TUNE' END,
CASE WHEN OLDLASER = '1' THEN 'OLDLASER' END,
CASE WHEN TELEINEVIL = '1' THEN 'TELEINEVIL' END,
CASE WHEN TELEIN = '1' THEN 'TELEIN' END,
CASE WHEN TELECHECK = '1' THEN 'TELECHECK' END,
CASE WHEN TELEINWEAPON = '1' THEN 'TELEINWEAPON' END,
CASE WHEN TELEINHOOK = '1' THEN 'TELEINHOOK' END,
CASE WHEN CHECKPOINT_FIRST = '1' THEN 'CHECKPOINT_FIRST' END,
CASE WHEN BONUS = '1' THEN 'BONUS' END,
CASE WHEN BOOST = '1' THEN 'BOOST' END,
CASE WHEN PLASMAF = '1' THEN 'PLASMAF' END,
CASE WHEN PLASMAE = '1' THEN 'PLASMAE' END,
CASE WHEN PLASMAU = '1' THEN 'PLASMAU' END), ',') AS tiles
FROM record_maps JOIN record_mapinfo ON record_maps.map = record_mapinfo.map
WHERE record_maps.map = $1; WHERE record_maps.map = $1;
", ",
map map
@ -133,49 +53,9 @@ impl Map {
sqlx::query_as!( sqlx::query_as!(
Map, Map,
" "
SELECT record_maps.map, category, points, stars, mappers, release, width, height, SELECT record_maps.map, category, points, stars, mappers, release, width, height, tiles
string_to_array(CONCAT_WS(',', FROM record_maps
CASE WHEN DEATH = '1' THEN 'DEATH' END, JOIN record_mapinfo_array ON record_maps.map = record_mapinfo_array.map
CASE WHEN THROUGH = '1' THEN 'THROUGH' END,
CASE WHEN JUMP = '1' THEN 'JUMP' END,
CASE WHEN DFREEZE = '1' THEN 'DFREEZE' END,
CASE WHEN EHOOK_START = '1' THEN 'EHOOK_START' END,
CASE WHEN HIT_END = '1' THEN 'HIT_END' END,
CASE WHEN SOLO_START = '1' THEN 'SOLO_START' END,
CASE WHEN TELE_GUN = '1' THEN 'TELE_GUN' END,
CASE WHEN TELE_GRENADE = '1' THEN 'TELE_GRENADE' END,
CASE WHEN TELE_LASER = '1' THEN 'TELE_LASER' END,
CASE WHEN NPC_START = '1' THEN 'NPC_START' END,
CASE WHEN SUPER_START = '1' THEN 'SUPER_START' END,
CASE WHEN JETPACK_START = '1' THEN 'JETPACK_START' END,
CASE WHEN WALLJUMP = '1' THEN 'WALLJUMP' END,
CASE WHEN NPH_START = '1' THEN 'NPH_START' END,
CASE WHEN WEAPON_SHOTGUN = '1' THEN 'WEAPON_SHOTGUN' END,
CASE WHEN WEAPON_GRENADE = '1' THEN 'WEAPON_GRENADE' END,
CASE WHEN POWERUP_NINJA = '1' THEN 'POWERUP_NINJA' END,
CASE WHEN WEAPON_RIFLE = '1' THEN 'WEAPON_RIFLE' END,
CASE WHEN LASER_STOP = '1' THEN 'LASER_STOP' END,
CASE WHEN CRAZY_SHOTGUN = '1' THEN 'CRAZY_SHOTGUN' END,
CASE WHEN DRAGGER = '1' THEN 'DRAGGER' END,
CASE WHEN DOOR = '1' THEN 'DOOR' END,
CASE WHEN SWITCH_TIMED = '1' THEN 'SWITCH_TIMED' END,
CASE WHEN SWITCH = '1' THEN 'SWITCH' END,
CASE WHEN STOP = '1' THEN 'STOP' END,
CASE WHEN THROUGH_ALL = '1' THEN 'THROUGH_ALL' END,
CASE WHEN TUNE = '1' THEN 'TUNE' END,
CASE WHEN OLDLASER = '1' THEN 'OLDLASER' END,
CASE WHEN TELEINEVIL = '1' THEN 'TELEINEVIL' END,
CASE WHEN TELEIN = '1' THEN 'TELEIN' END,
CASE WHEN TELECHECK = '1' THEN 'TELECHECK' END,
CASE WHEN TELEINWEAPON = '1' THEN 'TELEINWEAPON' END,
CASE WHEN TELEINHOOK = '1' THEN 'TELEINHOOK' END,
CASE WHEN CHECKPOINT_FIRST = '1' THEN 'CHECKPOINT_FIRST' END,
CASE WHEN BONUS = '1' THEN 'BONUS' END,
CASE WHEN BOOST = '1' THEN 'BOOST' END,
CASE WHEN PLASMAF = '1' THEN 'PLASMAF' END,
CASE WHEN PLASMAE = '1' THEN 'PLASMAE' END,
CASE WHEN PLASMAU = '1' THEN 'PLASMAU' END), ',') AS tiles
FROM record_maps JOIN record_mapinfo ON record_maps.map = record_mapinfo.map
WHERE category = $1; WHERE category = $1;
", ",
category category
@ -191,49 +71,9 @@ impl Map {
sqlx::query_as!( sqlx::query_as!(
Map, Map,
" "
SELECT record_maps.map, category, points, stars, mappers, release, width, height, SELECT record_maps.map, category, points, stars, mappers, release, width, height, tiles
string_to_array(CONCAT_WS(',', FROM record_maps
CASE WHEN DEATH = '1' THEN 'DEATH' END, JOIN record_mapinfo_array ON record_maps.map = record_mapinfo_array.map
CASE WHEN THROUGH = '1' THEN 'THROUGH' END,
CASE WHEN JUMP = '1' THEN 'JUMP' END,
CASE WHEN DFREEZE = '1' THEN 'DFREEZE' END,
CASE WHEN EHOOK_START = '1' THEN 'EHOOK_START' END,
CASE WHEN HIT_END = '1' THEN 'HIT_END' END,
CASE WHEN SOLO_START = '1' THEN 'SOLO_START' END,
CASE WHEN TELE_GUN = '1' THEN 'TELE_GUN' END,
CASE WHEN TELE_GRENADE = '1' THEN 'TELE_GRENADE' END,
CASE WHEN TELE_LASER = '1' THEN 'TELE_LASER' END,
CASE WHEN NPC_START = '1' THEN 'NPC_START' END,
CASE WHEN SUPER_START = '1' THEN 'SUPER_START' END,
CASE WHEN JETPACK_START = '1' THEN 'JETPACK_START' END,
CASE WHEN WALLJUMP = '1' THEN 'WALLJUMP' END,
CASE WHEN NPH_START = '1' THEN 'NPH_START' END,
CASE WHEN WEAPON_SHOTGUN = '1' THEN 'WEAPON_SHOTGUN' END,
CASE WHEN WEAPON_GRENADE = '1' THEN 'WEAPON_GRENADE' END,
CASE WHEN POWERUP_NINJA = '1' THEN 'POWERUP_NINJA' END,
CASE WHEN WEAPON_RIFLE = '1' THEN 'WEAPON_RIFLE' END,
CASE WHEN LASER_STOP = '1' THEN 'LASER_STOP' END,
CASE WHEN CRAZY_SHOTGUN = '1' THEN 'CRAZY_SHOTGUN' END,
CASE WHEN DRAGGER = '1' THEN 'DRAGGER' END,
CASE WHEN DOOR = '1' THEN 'DOOR' END,
CASE WHEN SWITCH_TIMED = '1' THEN 'SWITCH_TIMED' END,
CASE WHEN SWITCH = '1' THEN 'SWITCH' END,
CASE WHEN STOP = '1' THEN 'STOP' END,
CASE WHEN THROUGH_ALL = '1' THEN 'THROUGH_ALL' END,
CASE WHEN TUNE = '1' THEN 'TUNE' END,
CASE WHEN OLDLASER = '1' THEN 'OLDLASER' END,
CASE WHEN TELEINEVIL = '1' THEN 'TELEINEVIL' END,
CASE WHEN TELEIN = '1' THEN 'TELEIN' END,
CASE WHEN TELECHECK = '1' THEN 'TELECHECK' END,
CASE WHEN TELEINWEAPON = '1' THEN 'TELEINWEAPON' END,
CASE WHEN TELEINHOOK = '1' THEN 'TELEINHOOK' END,
CASE WHEN CHECKPOINT_FIRST = '1' THEN 'CHECKPOINT_FIRST' END,
CASE WHEN BONUS = '1' THEN 'BONUS' END,
CASE WHEN BOOST = '1' THEN 'BOOST' END,
CASE WHEN PLASMAF = '1' THEN 'PLASMAF' END,
CASE WHEN PLASMAE = '1' THEN 'PLASMAE' END,
CASE WHEN PLASMAU = '1' THEN 'PLASMAU' END), ',') AS tiles
FROM record_maps JOIN record_mapinfo ON record_maps.map = record_mapinfo.map
WHERE $1 = ANY(mappers) WHERE $1 = ANY(mappers)
", ",
mapper mapper