From 63eb5c5b65b10d3f5a489413cbba602982fc87f0 Mon Sep 17 00:00:00 2001 From: Werner <1331699+Arrow768@users.noreply.github.com> Date: Sun, 31 Dec 2023 19:57:07 +0100 Subject: [PATCH] Fixes IPC Tag Persistance (#18099) The query to save the IPC tag status (due to in-round-events) used the wrong table name. This has been corrected. Co-authored-by: Werner --- .../carbon/human/species/station/ipc/ipc.dm | 8 ++-- .../changelogs/arrow768-ipc-tags-save-fix.yml | 41 +++++++++++++++++++ 2 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 html/changelogs/arrow768-ipc-tags-save-fix.yml diff --git a/code/modules/mob/living/carbon/human/species/station/ipc/ipc.dm b/code/modules/mob/living/carbon/human/species/station/ipc/ipc.dm index e08ccdbc3d1..73a41b12016 100644 --- a/code/modules/mob/living/carbon/human/species/station/ipc/ipc.dm +++ b/code/modules/mob/living/carbon/human/species/station/ipc/ipc.dm @@ -208,14 +208,14 @@ if (!target || !player) return - if (establish_db_connection(GLOB.dbcon)) + if (establish_db_connection(GLOB.dbcon) && target.character_id) var/status = FALSE var/sql_status = FALSE if (target.internal_organs_by_name[BP_IPCTAG]) status = TRUE - var/list/query_details = list("ckey" = player.ckey, "character_name" = target.real_name) - var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT tag_status FROM ss13_ipc_tracking WHERE player_ckey = :ckey: AND character_name = :character_name:") + var/list/query_details = list("char_id" = target.character_id) + var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT tag_status FROM ss13_characters_ipc_tags WHERE char_id = :char_id:") query.Execute(query_details) if (query.NextRow()) @@ -224,7 +224,7 @@ return query_details["status"] = status - var/DBQuery/update_query = GLOB.dbcon.NewQuery("UPDATE ss13_ipc_tracking SET tag_status = :status: WHERE player_ckey = :ckey: AND character_name = :character_name:") + var/DBQuery/update_query = GLOB.dbcon.NewQuery("UPDATE ss13_characters_ipc_tags SET tag_status = :status: WHERE char_id = :char_id:") update_query.Execute(query_details) /datum/species/machine/get_light_color(mob/living/carbon/human/H) diff --git a/html/changelogs/arrow768-ipc-tags-save-fix.yml b/html/changelogs/arrow768-ipc-tags-save-fix.yml new file mode 100644 index 00000000000..9a2c514b26e --- /dev/null +++ b/html/changelogs/arrow768-ipc-tags-save-fix.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: arrow768 + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fixes IPC tag status not being saved properly in some cases."