示例#1
0
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
示例#2
0
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)