def merge_article_book_list(self): book_list = self.book_list[Type.article] book = Book() answer = [] for item in book_list: answer.append(item.sql.answer) book.kind = Type.article book.sql.answer = 'select * from Article where ({})'.format(' or '.join(answer)) self.book_list[Type.article] = [book] return
def merge_question_book_list(self): book_list = self.book_list[Type.question] book = Book() question = [] answer = [] for item in book_list: question.append(item.sql.question) answer.append(item.sql.answer) book.kind = Type.question book.sql.question = 'select * from Question where ({})'.format(' or '.join(question)) book.sql.answer = 'select * from Answer where ({})'.format(' or '.join(answer)) self.book_list[Type.question] = [book] return