当前位置: 首页>>代码示例>>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;未经允许,请勿转载。