Пример #1
0
    def take_statistic(self, records):
        self._pre_process(records)

        # 最先傳入的資料即為新的 Rank LastProfession LastCharacter
        self.rank = records[0][3]
        self.last_profession = DBAccessor.execute('select Profession from Character where Nickname=' +
                                                  convert_datum_to_command(records[0][1])).fetchone()[0]
        self.last_character = records[0][1]

        # 當沒有 in 3weeks, in 2months 的資料時,使 raised 為 0 的處理
        self.rank_3_weeks_ago = records[0][3]
        self.rank_2_months_ago = records[0][3]

        for record in records:
            recorded_date = convert_str_to_date(record[0])
            if recorded_date > self.date_of_3_weeks:
                self.rank_3_weeks_ago = record[3]
            if recorded_date > self.date_of_2_months:
                self.rank_2_months_ago = record[3]
            if not record[1] in self.used_characters:
                self.used_characters[record[1]] = record[2]

        self._post_process()
Пример #2
0
 def is_suitable_duration(self, time):
     return convert_str_to_date(self.end_day) > time
Пример #3
0
def get_since_all_record_date():
    specific_record = DBAccessor.execute('select {1} from {0} order by {1} desc limit 1 offset 25'.format(
        'FriendRecord' + get_account_name(), 'RecordedDate')).fetchone()
    specific_date = convert_str_to_date(specific_record[0] if specific_record else None)
    return str((date.today() - specific_date).days) if specific_date is not None else '?'
Пример #4
0
 def is_suitable_duration(self, time):
     return convert_str_to_date(self.end_day) > time