def get_pool_entries_by_name(pool_name): query = PoolTransactionModel.select().where( PoolTransactionModel.pool_name == pool_name) query2 = PoolTradeModel.select().where( PoolTradeModel.pool_name == pool_name) entries = [ model_to_dict_wrapper(entry, keys=DATETIME_KEYS) for entry in query ] entries += [ model_to_dict_wrapper(entry, keys=DATETIME_KEYS) for entry in query2 ] sorted_entries = sorted(entries, key=lambda k: (k['date'], k['time'])) return sorted_entries
def load_notes(offset): query = NoteModel.select().order_by(NoteModel.id.desc()).limit(10) notes = [model_to_dict_wrapper(note) for note in query] if len(notes) == 0: notes.append({'content': EMPTY_CONTENT}) notes[0]['max_offset'] = len(notes) return notes[offset]
def tail_by_name(name, num_lines): query = ExecutedJobModel.select()\ .where(ExecutedJobModel.name == name) \ .order_by(ExecutedJobModel.datetime_created.desc()) \ .limit(num_lines) return [model_to_dict_wrapper(line) for line in query]
def get_not_dismissed_entries(): query = FeedEntryModel.select() \ .where(FeedEntryModel.show) \ .limit(100) \ .order_by(FeedEntryModel.published_datetime.asc()) return [augment(model_to_dict_wrapper(item)) for item in query]