Was: EditBug:10104
Make-Variant does not copy all data OPEN I had set up variant titles for some reviews to change the reviewer's byline. This worked overall but the new parent records are missing the original author name for the reviews. Specifically, from the pseudonym's bibliography I had pulled down the list of reviews doing "Make This Title a Variant Title or Pseudonymous Work" and in the lower part of the page changing the author name from Frederick Patten to Fred Patten. Fred_Patten (http://www.isfdb.org/cgi-bin/ea.cgi?Fred_Patten)'s bibliography shows these reviews with an "[as by Frederick Patten ]" instead of "by H. Beam Piper" and if you click on the review link you are shown something like title 588821 (http://www.isfdb.org/cgi-bin/title.cgi?588821) and the Book Author: field is blank. I'm guessing the book author is stored in something like the title record's Notes field and that this did not get copied when the variant-title was created. Marc Kupper (talk) 16:57, 24 May 2007 (CDT)
Anonymous
There's two authors required for reviews, and make variant only creates one. I've changed mod/ka_new.py 1.3 to copy over the canonical_author reviewee entries (status=3) when the variant type is REVIEW.
To fix the existing problems, I think this will create the missing records. Seems to work for me locally at least. Probably needs a lot of checking before anyone decides to run it on the live server.
And can it be run in this format anyway, or should we creating wrapper Python Scripts for adhoc fixes?
insert into canonical_author (title_id, author_id, ca_status)
select t.title_id, ca2.author_id, 3
from titles t, titles t2, canonical_author ca2
where t.title_ttype = 'REVIEW'
and t2.title_ttype = 'REVIEW'
and t.title_id = t2.title_parent
and ca2.title_id = t2.title_id
and ca2.ca_status = 3
and NOT EXISTS (select 1 from canonical_author ca
WHERE t.title_id = ca.title_id
and ca.ca_status = 3)
There are also INTERVIEWs to be considered, like:
http://isfdb.org/cgi-bin/title.cgi?989823
(parent without interviewees).
SELECT t.title_id, t.title_title
FROM titles t, titles t2
WHERE
t.title_ttype = 'INTERVIEW'
and t.title_id = t2.title_parent;
33 rows in set
and most of them seems to have problems; e.g. in
http://isfdb.org/cgi-bin/title.cgi?167398
the parent has an interviewee but its variant does not.
mod/ka_new.py 1.4 committed to deal with INTERVIEW types as well. SQL for fixing existing data problems:
insert into canonical_author (title_id, author_id, ca_status)
select t.title_id, ca2.author_id, 2
from titles t, titles t2, canonical_author ca2
where t.title_ttype = 'INTERVIEW'
and t2.title_ttype = 'INTERVIEW'
and t.title_id = t2.title_parent
and ca2.title_id = t2.title_id
and ca2.ca_status = 2
and NOT EXISTS (select 1 from canonical_author ca
WHERE t.title_id = ca.title_id
and ca.ca_status = 2)
Fix scripts added: scripts/fix_missing_reviewees.sql 1.1, scripts/fix_missing_interviewees.sql 1.1
Implemented in r2009-04.