From f368b5dcf558ab52890abe838df5a4f2ff2dce88 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Wed, 8 Oct 2025 16:55:52 +0000 Subject: [PATCH] Fix problems #31 and #32 by trimming spaces and upper-casing in clean --- conversion/clean.sql | 23 ++++++++++++++++++++++- conversion/load_data.sql | 12 +++--------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/conversion/clean.sql b/conversion/clean.sql index 3230d4b..23df67f 100644 --- a/conversion/clean.sql +++ b/conversion/clean.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2023 The Meme Factory, Inc. http://www.karlpinc.com/ +-- Copyright (C) 2023, 2025 The Meme Factory, Inc. http://www.karlpinc.com/ -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU Affero General Public License as @@ -139,6 +139,11 @@ UPDATE biography SET b_sex = 'M' WHERE b_animid = 'UNK'; + +-- +-- follow +-- + -- Update the follow table to use the mixed-case version of -- the observer code. -- Conversion problem #40 @@ -211,3 +216,19 @@ UPDATE follow AND NOT EXISTS (SELECT 1 FROM people WHERE people.person = fol_pm_observer_2); + +-- +-- Get rid of trailing spaces from follow.fol_b_animid +-- Problem #31 +-- +UPDATE follow + SET fol_b_animid = RTRIM(fol_b_animid) + WHERE fol_b_animid <> RTRIM(fol_b_animid); + +-- +-- Make follow.fol_b_animid upper-case +-- Problem #32 +-- +UPDATE follow + SET fol_b_animid = UPPER(fol_b_animid) + WHERE fol_b_animid <> UPPER(fol_b_animid); diff --git a/conversion/load_data.sql b/conversion/load_data.sql index 82e649c..36db860 100644 --- a/conversion/load_data.sql +++ b/conversion/load_data.sql @@ -272,9 +272,7 @@ INSERT INTO follows ( , community , date , notes) -SELECT upper( -- problem #31) - btrim( -- Problem #32 - fol_b_animid)) +SELECT fol_b_animid , fol_cl_community_id , fol_date , '' @@ -337,9 +335,7 @@ INSERT INTO follow_observers ( , obs_brec , obs_tiki) WITH obs AS ( -SELECT upper( -- problem #31 - btrim( -- problem #32 - follow.fol_b_animid)) AS fol_b_animid +SELECT follow.fol_b_animid , follow.fol_date , follow.fol_am_observer_1 AS am_obs1 , follow.fol_am_observer_2 AS am_obs2 @@ -403,9 +399,7 @@ INSERT INTO follow_observers ( SELECT (SELECT follows.fid FROM follows - WHERE follows.focal = upper( -- problem #31 - btrim( -- problem #32 - follow.fol_b_animid)) + WHERE follows.focal = follow.fol_b_animid AND follows.date = follow.fol_date) , 'UNK' , 'NONE' -- 2.34.1