chiark / gitweb /
Added search by name
authornaath <naath@chiark.greenend.org.uk>
Sun, 6 Apr 2014 17:39:12 +0000 (18:39 +0100)
committernaath <naath@chiark.greenend.org.uk>
Sun, 6 Apr 2014 17:39:12 +0000 (18:39 +0100)
cgiFiles/ancestors.py [changed mode: 0644->0755]
cgiFiles/countNames.py [changed mode: 0644->0755]
cgiFiles/everyPage.py [changed mode: 0644->0755]
cgiFiles/listPeople.py [changed mode: 0644->0755]
cgiFiles/listTerr.py [changed mode: 0644->0755]
cgiFiles/person.py [changed mode: 0644->0755]
cgiFiles/territory.py [changed mode: 0644->0755]
familyTree/askQuestion.py
familyTree/printLists.py

old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 179888c62ab38b357a019de984fdad3bc27066db..364f08888f0e1cdf4e1050b36bc298f70ad660dd 100755 (executable)
@@ -77,7 +77,16 @@ def print_age_count(row,newLine):
                         + link + newLine
        else:
                return print_row(row,newLine)
-       
+
+
+def print_name_count(row,newLine):
+       if newLine=='<br>':
+               script = "name.py?name=" + row[0]
+               link = link_Template.substitute(script =\
+                       script, text = row[0])
+               return str(row[1]) + " people called "+link + newLine
+       else:
+               return print_row(row,newLine)   
 
 def print_tagged_name(relationship,row,newLine):
        if row[0]==None:
@@ -227,8 +236,23 @@ def count_names(newLine):
        +" GROUP BY firstName"\
        +" ORDER BY count(*) DESC;"
 
-       out = print_query(s,(),newLine)
-       
+       out = ''
+       for row in run_query(s,()):
+               out = out + print_name_count(row,newLine)
+
+       return out
+
+def people_with_name(name,newLine):
+       s = "SELECT Name, ID"\
+       +" FROM people"\
+       +" WHERE Name LIKE ?;"
+
+       out = ''
+
+       t = (name + '%',)
+
+       for row in run_query(s,t):
+               out = out + name_html(row,newLine) + newLine
 
        return out
 
index f0810f09d7d328031c07838e0b922aeb6946db35..0332d8e43da8f917ede3261217ebcf40b428d922 100755 (executable)
@@ -7,9 +7,9 @@ import sys
 conn = askQuestion.connect()
 
 
-#o = askQuestion.count_names('\n')
+o = askQuestion.count_names('\n')
 
-#print o
+print o
 
 #o = askQuestion.count_birth_month('\n')
 #print o
@@ -24,7 +24,7 @@ conn = askQuestion.connect()
 #o = askQuestion.list_people('\n')
 #print o
 
-o = askQuestion.count_age_at_child('\n')
-print o
+#o = askQuestion.count_age_at_child('\n')
+#print o
 
 askQuestion.close(conn)