def lectorder_get(): query = LectOrder.all() rec = query.get() if rec == None or len(rec.lecture_order) == 0: lectorder_init() query = LectOrder.all() rec = query.get() no = rec.lecture_order.pop() db.put(rec) return no
def lectorder_init(): query = LectOrder.all() if query.count() > 0: rec = query.get() db.delete(rec) obj = LectOrder() for i in range(1,KOUGI_NUM + 1): obj.lecture_order.append(i) random.shuffle(obj.lecture_order) db.put(obj)