common.InsertSitting(c, sittings[i]) common.FileLog(c, sittings[i]['name']) # absent absent_match = Absent_Token.search(one_sitting_text) exclude = [] if absent_match: names = re.sub(u'(副?議長|議員)', '', absent_match.group('names')) names = re.sub(u'、', ' ', names) if names: exclude = common.Attendance(c, sittings[i], names, 'CS', 'absent') else: print one_sitting_text raise # present for councilor_id in in_office_ids(sittings[i]['date'], exclude): common.AddAttendanceRecord(c, councilor_id, sittings[i]['uid'], 'CS', 'present') # <-- # --> votes IterVote(one_sitting_text, sittings[i]) # <-- conn.commit() print 'votes, voter done!' print 'update meeting_minutes download links' meetings = json.load(open('../../../data/kcc/meeting_minutes-%s.json' % election_year)) for meeting in meetings: meeting['links'] = {'url': meeting['download_url'], 'note': u'議會官網會議紀錄'} meeting['name'] = re.sub(u'第0+', u'第', u'%s議會%s' % (meeting['county'], meeting['meeting'])) meeting['name'] = re.sub(u'紀錄.*$', '', meeting['name']) print meeting['name'] common.UpdateSittingLinks(c, meeting)
"date": meeting['date'] } # --> sittings, attendance, filelog print sitting common.InsertSitting(c, sitting) common.FileLog(c, sitting['name']) # present present_match = Present_Token.search(total_text) exclude = [] if present_match: names = re.sub(u'(副?議長|議員)', '', present_match.group('names')) if names: exclude.extend( common.Attendance(c, sitting, names, 'CS', 'present')) else: print total_text raise # no councilor's name to record if exclude == []: continue # absent for councilor_id in in_office_ids(sitting['date'], exclude): common.AddAttendanceRecord(c, councilor_id, sitting['uid'], 'CS', 'absent') # <-- print 'votes, voter done!' vote_common.person_attendance_param(c, county) conn.commit() print 'Succeed'