示例#1
0
    date = ly_common.GetDate(sourcetext)
    if int(ms.group('ad')) != ad:
        print 'Skip'
        continue
    else:
        if not date:
            print 'Can not find meeting date from minutes, please check file!!'
            raw_input()
            continue
    sitting_dict = {
        "uid": uid,
        "name": meeting['name'],
        "ad": ms.group('ad'),
        "date": date,
        "session": ms.group('session'),
        "links": meeting['links']
    }
    ly_common.InsertSitting(c, sitting_dict)
    ly_common.FileLog(c, meeting['name'])
    ly_common.Attendance(c, sitting_dict, sourcetext, u'出席委員[:: ]?', 'YS',
                         'present')
    ly_common.Attendance(c, sitting_dict, sourcetext, u'請假委員[:: ]?', 'YS',
                         'absent')
    IterVote(sourcetext, sitting_dict)

vote_common.conscience_vote(c, ad)
vote_common.not_voting_and_results(c)
vote_common.vote_param(c)
vote_common.attendance_param(c)
conn.commit()
    absent_match = Absent_Token.search(one_sitting_text)
    if absent_match:
        common.Attendance(c, sittings[i], absent_match.group('names'), 'CS',
                          'absent')
    # <--
    # --> votes
    IterVote(one_sitting_text, sittings[i])
    # <--
conn.commit()
print 'votes, voter done!'

print 'update meeting_minutes download links'
meetings = json.load(
    open('../../../data/tcc/meeting_minutes-%s.json' % election_year))
for meeting in meetings:
    meeting['county'] = county
    meeting['links'] = {'url': meeting['download_url'], 'note': u'議會官網會議紀錄'}
    meeting['name'] = re.sub(
        u'第0+', u'第', u'%s議會%s%s' %
        (meeting['county'], meeting['sitting'], meeting['meeting']))
    meeting['name'] = re.sub(u'紀錄$', '', meeting['name'])
    common.UpdateSittingLinks(c, meeting)
print 'done!'

vote_common.conscience_vote(c, election_year, county)
vote_common.not_voting_and_results(c, county)
vote_common.person_vote_param(c, county)
vote_common.person_attendance_param(c, county)
conn.commit()
print 'Succeed'
示例#3
0
    print '[%s]' % meeting['name']
    #--> meeting info already there but meeting_minutes haven't publish
    if not os.path.exists('vote/meeting_minutes/%s.txt' % meeting['name']):
        print 'File not exist, please check!!'
        raw_input()
        continue
    #<--
    sourcetext = codecs.open('vote/meeting_minutes/%s.txt' % meeting['name'], 'r', 'utf-8').read()
    ms, uid = ly_common.SittingDict(meeting['name'])
    date = ly_common.GetDate(sourcetext)
    if int(ms.group('ad')) != ad or uid in sitting_ids:
        print 'Skip'
        continue
    else:
        if not date:
            print 'Can not find meeting date from minutes, please check file!!'
            raw_input()
            continue
    sitting_dict = {"uid": uid, "name": meeting['name'], "ad": ms.group('ad'), "date": date, "session": ms.group('session'), "links": meeting['links']}
    ly_common.InsertSitting(c, sitting_dict)
    ly_common.FileLog(c, meeting['name'])
    ly_common.Attendance(c, sitting_dict, sourcetext, u'出席委員[::]?', 'YS', 'present')
    ly_common.Attendance(c, sitting_dict, sourcetext, u'請假委員[::]?', 'YS', 'absent')
    IterVote(sourcetext, sitting_dict)

vote_common.conscience_vote(c, ad)
vote_common.not_voting_and_results(c)
vote_common.vote_param(c)
vote_common.attendance_param(c)
conn.commit()