當前位置: 首頁>>代碼示例>>Python>>正文


Python Submission.all方法代碼示例

本文整理匯總了Python中models.Submission.all方法的典型用法代碼示例。如果您正苦於以下問題:Python Submission.all方法的具體用法?Python Submission.all怎麽用?Python Submission.all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.Submission的用法示例。


在下文中一共展示了Submission.all方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_level_stats

# 需要導入模塊: from models import Submission [as 別名]
# 或者: from models.Submission import all [as 別名]
    def get_level_stats(self, format, delta = datetime.timedelta(), page = 0, limit = 100):
        level = get_current_level()
            
        if level is not None:
            submissions = Submission.all().filter("time >", level.time - delta).order('time').order('-score').fetch(limit, page * limit)

            i = 1
            ranks = []
            for submission in submissions:
                obj = {"rank" : i,
                      "user" : submission.user.name,
                      "score" : submission.score}
                
                if format == "json":
                    ranks.append(obj)
                elif format == "xml":
                    ranks.append({"ranking": obj})
                
                i = i + 1
            
            res = {"response": ranks}
        else :
            res = {"response": {"error": "could not get the level"}}
            
        if format == "json":
            return simplejson.dumps(res)
        elif format == "xml":
            return dict2xml(res).to_string()
開發者ID:akawry,項目名稱:seekword,代碼行數:30,代碼來源:main.py

示例2: get_all_attempts

# 需要導入模塊: from models import Submission [as 別名]
# 或者: from models.Submission import all [as 別名]
 def get_all_attempts(self, magic, level, problemid, prob_type):
     return (
         Submission.all()
         .filter("student_magic_number =", str(magic))
         .filter("type =", str(prob_type))
         .filter("level =", level)
         .filter("problem_id =", problemid)
     )
開發者ID:jhopwood,項目名稱:Adaptive-Cs233-Branch,代碼行數:10,代碼來源:base_handler.py

示例3: get

# 需要導入模塊: from models import Submission [as 別名]
# 或者: from models.Submission import all [as 別名]
 def get(self):
   magic = self.request.get('student')
   submissions = Submission.all().filter('student_magic_number =', str(magic))
   submissions_objects = []
   for submission in submissions:
      utc = int(time.mktime(submission.answered_on.timetuple()))
      submissions_objects.append({"type":submission.type, "level":submission.level, "id":submission.problem_id, "score":submission.score, "answered_on":utc, "answer":submission.answer})
   blob = json.dumps(submissions_objects)
   self.response.out.write(blob)
開發者ID:mansara2,項目名稱:cache,代碼行數:11,代碼來源:main.py

示例4: get

# 需要導入模塊: from models import Submission [as 別名]
# 或者: from models.Submission import all [as 別名]
	def get(self):
		submissions = []
		#subs= Submission.gql("WHERE pid=:1", 11)
		for submission in Submission.all().order('-post_time'):
			submissions.append({
				'name': submission.name,
				'pid': submission.pid,
				'image_url': submission.image_url,
            })
        	self.response.out.write(json.dumps(submissions))
開發者ID:jonkiersey,項目名稱:clupics,代碼行數:12,代碼來源:main.py

示例5: get_all_attempts

# 需要導入模塊: from models import Submission [as 別名]
# 或者: from models.Submission import all [as 別名]
	def get_all_attempts(self, magic, level, problemid, prob_type):
		return Submission.all().filter('student_magic_number =', str(magic)).filter('type =', str(prob_type)).filter('level =', level).filter('problem_id =', problemid)
開發者ID:jhopwood,項目名稱:Adaptive-Cs233-Branch,代碼行數:4,代碼來源:adaptive_base_handler.py


注:本文中的models.Submission.all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。