예제 #1
0
    def handle(self, *args, **options):
        u = Uva()
        for p in u.getProblems():
            try:
                problem = Problem.objects.get(code=p['id'], judge='uva')
            except Problem.DoesNotExist:
                problem = Problem()

            problem.code = p['id']
            problem.number = p['number']
            problem.name = p['name']
            problem.category = p['category']
            problem.solved = p['solved']
            problem.level = 0
            problem.judge = 'uva'
            problem.save()
예제 #2
0
    def handle(self, *args, **options):
        s = Spoj()
        problems = s.getProblems()

        for p in problems:
            try:
                problem = Problem.objects.get(code=p['code'], judge='spoj')
            except Problem.DoesNotExist:
                problem = Problem()

            problem.name = p['name']
            problem.code = p['code']
            problem.number = p['number']
            problem.solved = p['solved']

            problem.category = 'U'
            problem.level = 0
            problem.judge = 'spoj'
            problem.save()

        print('%d problems.' % len(problems))
예제 #3
0
	def handle(self, *args, **options):
		s = Spoj()
		problems = s.getProblems()

		for p in problems:
			try:
				problem = Problem.objects.get(code=p['code'], judge='spoj')
			except Problem.DoesNotExist:
				problem = Problem()

			problem.name = p['name']
			problem.code = p['code']
			problem.number = p['number']
			problem.solved = p['solved']

			problem.category = 'U'
			problem.level = 0
			problem.judge = 'spoj'
			problem.save()

		print('%d problems.' % len(problems))