示例#1
0
def load_voterinfo(booth_id):
    logging.info("loading voterinfo for booth id %s", booth_id)

    booth = db.select("booth", where="id=$booth_id", vars=locals())[0]
    search = voterlib.get_voter_search(booth.state)

    result = db.select("voter",
                       what="voterid",
                       where="name is NULL and booth_id=$booth_id",
                       vars=locals()).list()

    data = (search.get_voter_info(row.voterid) for row in result)
    for row in data:
        if not row:
            continue
        db.update("voter",
                  where="voterid=$epic_no",
                  vars=row,
                  serial_number=row.get('slno_inpart'),
                  name=row.get('name'),
                  name2=row.get('name_v1'),
                  rel_name=row.get('rln_name'),
                  rel_name2=row.get('rln_name_v1'),
                  gender=row.get('gender'),
                  age=row.get('age'),
                  address=row.get('house_no'))
示例#2
0
def load_voterinfo(booth_id):
    logging.info("loading voterinfo for booth id %s", booth_id)

    booth = db.select("booth", where="id=$booth_id", vars=locals())[0]
    search = voterlib.get_voter_search(booth.state)

    result = db.select("voter", what="voterid", where="name is NULL and booth_id=$booth_id", vars=locals()).list()

    data = (search.get_voter_info(row.voterid) for row in result)
    for row in data:
        if not row:
            continue
        db.update(
            "voter",
            where="voterid=$epic_no",
            vars=row,
            serial_number=row.get("slno_inpart"),
            name=row.get("name"),
            name2=row.get("name_v1"),
            rel_name=row.get("rln_name"),
            rel_name2=row.get("rln_name_v1"),
            gender=row.get("gender"),
            age=row.get("age"),
            address=row.get("house_no"),
        )
示例#3
0
 def addCurrencyUse(self, currency):
     self.currencyPriority[currency] += 1
     self.currencyPriority = dict(
         sorted(self.currencyPriority.items(),
                key=operator.itemgetter(1),
                reverse=True))
     li = json.dumps(self.currencyPriority)
     db.update('users', 'currencypriority', f"'{li}'::json",
               f"id={self.id}")
示例#4
0
 def POST(self, state=None, ac=None, pb=None):
     where = self.construct_where(state=state, ac=ac, pb=pb) + " AND name is NULL"
     result = db.select("voter, booth", what="voterid", where=where, limit=100).list()
     data = [voterlib.get_voter_info(row.voterid) for row in result]
     with db.transaction():
         for row in data:
             print row
             db.update(
                 "voter",
                 where="voterid=$epic_no",
                 vars=row,
                 serial_number=row["slno_inpart"],
                 name=row["name"],
                 name2=row["name_v1"],
                 rel_name=row["rln_name"],
                 rel_name2=row["rln_name_v1"],
                 gender=row["gender"],
                 age=row["age"],
                 address=row["house_no"],
             )
示例#5
0
 def POST(self, state=None, ac=None, pb=None):
     where = self.construct_where(state=state, ac=ac,
                                  pb=pb) + " AND name is NULL"
     result = db.select("voter, booth",
                        what="voterid",
                        where=where,
                        limit=100).list()
     data = [voterlib.get_voter_info(row.voterid) for row in result]
     with db.transaction():
         for row in data:
             print row
             db.update("voter",
                       where="voterid=$epic_no",
                       vars=row,
                       serial_number=row['slno_inpart'],
                       name=row['name'],
                       name2=row['name_v1'],
                       rel_name=row['rln_name'],
                       rel_name2=row['rln_name_v1'],
                       gender=row['gender'],
                       age=row['age'],
                       address=row['house_no'])
示例#6
0
 def deleteNotification(self):
     db.update('users', 'notify', 'NULL', f"id={self.id}")
     self.notify = None
示例#7
0
 def setNotificetionTime(self, time: str):
     db.update('users', 'notify', f"'{time}'", f"id={self.id}")
     self.notify = time
示例#8
0
 def setMainCity(self, cityLink):
     idCity = db.getFromDB('citylist', 'id', f"link='{cityLink}'")[0][0]
     self.location = idCity
     db.update('users', 'location', idCity, f'id={self.id}')
示例#9
0
 def setUserCurrency(self, userCurrency):
     self.userCurrency = userCurrency
     db.update('users', 'maincurrency', f"ARRAY[{userCurrency}]",
               f"id={self.id}")
示例#10
0
 def setDayForShow(self, numberForShow):
     self.dayForShow = numberForShow
     db.update('users', 'dayforshow', numberForShow, f"id={self.id}")
示例#11
0
 def setCurrency(self, currency):
     self.currency = currency
     db.update('users', 'currency', f"'{currency}'", f"id={self.id}")