chiark / gitweb /
Fixed common ancestors to not print the common ancestors twice
[familyTree.git] / familyTree / askQuestion.py
index 7606ab59441bf4708f943fb3669119dba4e981a9..3c1b999930aa1eed2d4482dc7f51c0297c4b0aeb 100755 (executable)
@@ -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: