From 1eaaa2e6ac358c03990f5ce562b1cba87058e3bd Mon Sep 17 00:00:00 2001 From: naath Date: Sun, 6 Apr 2014 21:30:48 +0100 Subject: [PATCH] Fixed common ancestors to not print the common ancestors twice --- familyTree/askQuestion.py | 28 ++++++++++++++++++---------- familyTree/notes | 2 +- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/familyTree/askQuestion.py b/familyTree/askQuestion.py index 7606ab5..3c1b999 100755 --- a/familyTree/askQuestion.py +++ b/familyTree/askQuestion.py @@ -73,8 +73,14 @@ def print_age_count(row,newLine): script = "age.py?age="+str(row[0]) link = link_Template.substitute(script = \ script, text = row[0]) - return str(row[1]) + ' people had children at age '\ - + link + newLine + out = str(row[1]) + if row[1]>1: + out = out + ' people ' + else: + out = out + ' person ' + + out = out + 'had children at age '+ link + newLine + return out else: return print_row(row,newLine) @@ -374,8 +380,10 @@ def all_ancestors(personID,newLine): for ancestor in ancestors: id = (ancestor,) for row in run_query(s,id): - thisout = thisout + name_html(row,newLine)+newLine - if row[1] not in allAncestors and is_number(row[1])!=0: + thisout = thisout + \ + name_html(row,newLine)+newLine + if row[1] not in allAncestors and \ + is_number(row[1])!=0: newA.append(row[1]) allAncestors.append(row[1]) trackLevel.append(level) @@ -475,12 +483,12 @@ def common_ancestors(IDA, IDB,newLine): out = out + ' of ' + name_html([names[0],IDA],newLine)+newLine - out = out + newLine - for b in indexB: - t = (common[b],) - out = out + print_tagged_query('',s,t,newLine) - if b!=indexB[-1]: - out = out + 'and' + newLine + #out = out + newLine + #for b in indexB: + # t = (common[b],) + # out = out + print_tagged_query('',s,t,newLine) + # if b!=indexB[-1]: + # out = out + 'and' + newLine out = out + parent_level(bLevels[indexB[0]],'parent') if len(indexB)>1: diff --git a/familyTree/notes b/familyTree/notes index eee7969..50e1e91 100644 --- a/familyTree/notes +++ b/familyTree/notes @@ -9,7 +9,7 @@ Deal with Consorts, this means including DATES OF MARRIAGE AND DIVORCE ELEANOR OF CASTILE has the WRONG PARENTS!!!! check others with bad age-at-child numbers edmund tudor's birth year is wrong - +Kathering Swynford is spelled wrong territories - some numbers got in there. -- 2.30.2