chiark / gitweb /
Include offices held in guessing year born
authornaath <naath@chiark.greenend.org.uk>
Sun, 6 Apr 2014 18:51:24 +0000 (19:51 +0100)
committernaath <naath@chiark.greenend.org.uk>
Sun, 6 Apr 2014 18:51:24 +0000 (19:51 +0100)
familyTree/askQuestion.py

index 364f08888f0e1cdf4e1050b36bc298f70ad660dd..7606ab59441bf4708f943fb3669119dba4e981a9 100755 (executable)
@@ -216,6 +216,20 @@ def list_people(newLine):
                                if bornAfter==0:
                                        bornAfter = hadChild[0]-100
                        
+                       u = "Select styles.startYear, styles.style from"\
+                                +" people INNER JOIN styles"\
+                                +" ON people.ID = styles.ID"\
+                                +" WHERE people.ID = ? and"\
+                                +" styles.startYear <>0"\
+                                +" ORDER BY styles.startYear;"
+
+                        for r in run_query(u,t):
+                                out = out + r[1] + " from " + str(r[0])\
+                                + newLine
+                               if bornAfter ==0:
+                                       bornAfter = r[0] -100
+                                break
+
                        if bornAfter!=0:
                                if bornBefore == 0: 
                                        out = out + "probably born "\
@@ -226,7 +240,6 @@ def list_people(newLine):
                                                +" and " + str(bornBefore)
                                out = out + newLine
 
-
                year = row[2]
        return out
 
@@ -660,8 +673,9 @@ def person_info(personID,newLine):
                        output = output + print_tagged_name('With',r,newLine)
 
                #age when child born
-               age = row[2]-bornYear
-               output = output[:-4] + " at the age of "+str(age) + newLine
+               if row[2] !=0 and bornYear != 0:
+                       age = row[2]-bornYear
+                       output = output[:-4] + " at the age of "+str(age) + newLine
 
        output = output + newLine