Skip to content

Commit 4d8ba23

Browse files
committed
Merge branch 'master' of https://github.com/segment-oj/segmentoj
2 parents 9671d79 + 4474980 commit 4d8ba23

File tree

5 files changed

+72
-7
lines changed

5 files changed

+72
-7
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [master]
9+
schedule:
10+
- cron: '0 22 * * 3'
11+
12+
jobs:
13+
analyze:
14+
name: Analyze
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
# Override automatic language detection by changing the below list
21+
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
22+
language: ['python']
23+
# Learn more...
24+
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v2
29+
with:
30+
# We must fetch at least the immediate parents so that if this is
31+
# a pull request then we can checkout the head.
32+
fetch-depth: 2
33+
34+
# If this run was triggered by a pull request event, then checkout
35+
# the head of the pull request instead of the merge commit.
36+
- run: git checkout HEAD^2
37+
if: ${{ github.event_name == 'pull_request' }}
38+
39+
# Initializes the CodeQL tools for scanning.
40+
- name: Initialize CodeQL
41+
uses: github/codeql-action/init@v1
42+
with:
43+
languages: ${{ matrix.language }}
44+
45+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
46+
# If this step fails, then you should remove it and run the build manually (see below)
47+
- name: Autobuild
48+
uses: github/codeql-action/autobuild@v1
49+
50+
# ℹ️ Command-line programs to run using the OS shell.
51+
# 📚 https://git.io/JvXDl
52+
53+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
54+
# and modify them (or add more) to build your code if your project
55+
# uses a compiled language
56+
57+
#- run: |
58+
# make bootstrap
59+
# make release
60+
61+
- name: Perform CodeQL Analysis
62+
uses: github/codeql-action/analyze@v1

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ A OnlineJudge using Django and Docker.
88
[![Repo Size](https://img.shields.io/github/repo-size/szdytom/segmentoj)](https://github.com/szdytom/segmentoj/)
99
[![Python 3](https://pyup.io/repos/github/segment-oj/segmentoj/python-3-shield.svg)](https://pyup.io/repos/github/segment-oj/segmentoj/)
1010
[![Updates](https://pyup.io/repos/github/segment-oj/segmentoj/shield.svg)](https://pyup.io/repos/github/segment-oj/segmentoj/)
11+
![visitors](https://visitor-badge.laobi.icu/badge?page_id=segmentoj)
1112

1213
---
1314

problem/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ def process_data(x):
135135
problems = pg.paginate_queryset(queryset=queryset, request=request, view=self)
136136

137137
ps = ProblemListSerializer(problems, many=True)
138-
return Response(
139-
{"count": queryset.count(), "res": [process_data(x) for x in ps.data]},
140-
status=status.HTTP_200_OK,
141-
)
138+
return Response({
139+
"count": queryset.count(),
140+
"res": [process_data(x) for x in ps.data]
141+
}, status=status.HTTP_200_OK)
142142

143143
class ProblemListCountView(APIView):
144144
def get(self, request):

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ black==19.10b0
66
click==7.1.2
77
coverage==5.2.1
88
Django==3.1
9-
django-cors-headers==3.4.0
9+
django-cors-headers==3.5.0
1010
django-filter==2.3.0
1111
djangorestframework==3.11.1
1212
lazy-object-proxy==1.4.3

status/views.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ def process(x):
7474
statuses = pg.paginate_queryset(queryset=queryset, request=request, view=self)
7575

7676
ss = StatusListSerializer(statuses, many=True)
77-
return Response({"res": [process(x) for x in ss.data]}, status=status.HTTP_200_OK)
78-
77+
return Response({
78+
"count": queryset.count(),
79+
"res": [process(x) for x in ss.data]
80+
}, status=status.HTTP_200_OK)
7981

8082
class StatusListCountView(APIView):
8183
def get(self, request):

0 commit comments

Comments
 (0)