def test_create_judge(self): """ Test creating a judge. """ judge = Judge(competition=self.competition, username="******", password="******", email="*****@*****.**") judge.save() self.assertIsNotNone(judge)
def get_judges(request): last_online_time = Judge.last_online_time() if request.user.is_superuser or request.user.is_staff: return True, list(chain(Judge.objects.filter(last_ping__gte=last_online_time), Judge.objects.exclude(last_ping__gte=last_online_time))) else: return False, Judge.objects.filter(last_ping__gte=last_online_time)
def get_context_data(self, **kwargs): context = super(LanguageJudgesAjaxList, self).get_context_data(**kwargs) context['judges'] = Judge.objects.filter( runtimes__key=self.lang, last_ping__gte=Judge.last_online_time()).order_by('load') return context
def __init__(self, *args, **kwargs): super(ProblemSubmitForm, self).__init__(*args, **kwargs) self.fields['problem'].empty_label = None self.fields['problem'].widget = forms.HiddenInput() self.fields['language'].empty_label = None self.fields['language'].label_from_instance = attrgetter('display_name') self.fields['language'].queryset = Language.objects.filter( judges__last_ping__gte=Judge.last_online_time()).distinct()
def status_table(request): see_all, judges = get_judges(request) return render( request, 'status/judge-status-table.html', { 'judges': judges, 'runtime_version_data': Judge.runtime_versions(), 'see_all_judges': see_all, })
def get_judges(request): last_online_time = Judge.last_online_time() if request.user.is_superuser or request.user.is_staff: return True, list( chain(Judge.objects.filter(last_ping__gte=last_online_time), Judge.objects.exclude(last_ping__gte=last_online_time))) else: return False, Judge.objects.filter(last_ping__gte=last_online_time)
def status_all(request): see_all, judges = get_judges(request) return render( request, 'status/judge-status.html', { 'title': _('Status'), 'judges': judges, 'runtime_version_data': Judge.runtime_versions(), 'see_all_judges': see_all, })
def __init__(self, *args, **kwargs): super(ProblemSubmitForm, self).__init__(*args, **kwargs) self.fields['problem'].empty_label = None self.fields['problem'].widget = forms.HiddenInput() self.fields['language'].empty_label = None self.fields['language'].label_from_instance = attrgetter( 'display_name') self.fields['language'].queryset = Language.objects.filter( judges__last_ping__gte=Judge.last_online_time()).distinct()
def get_context_data(self, **kwargs): context = super(LanguageJudgesAjaxList, self).get_context_data(**kwargs) context["judges"] = Judge.objects.filter( runtimes__key=self.lang, last_ping__gte=Judge.last_online_time() ).order_by("load") return context
def get_context_data(self, **kwargs): context = super(LanguageDetail, self).get_context_data(**kwargs) context["judges"] = self.object.judges.filter(last_ping__gte=Judge.last_online_time()).order_by("load") return context
def handle(self, *args, **options): judge = Judge() judge.name = options['name'] judge.auth_key = options['auth_key'] judge.save()
def get_context_data(self, **kwargs): context = super(LanguageDetail, self).get_context_data(**kwargs) context['judges'] = self.object.judges.filter( last_ping__gte=Judge.last_online_time()).order_by('load') return context