Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
zesje
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Réouven ASSOULY
zesje
Commits
f09dd532
Commit
f09dd532
authored
7 years ago
by
Thomas Roos
Browse files
Options
Downloads
Patches
Plain Diff
New problems API
parent
805e1a36
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
zesje/api.py
+2
-0
2 additions, 0 deletions
zesje/api.py
zesje/resources/problems.py
+31
-0
31 additions, 0 deletions
zesje/resources/problems.py
with
33 additions
and
0 deletions
zesje/api.py
+
2
−
0
View file @
f09dd532
...
...
@@ -7,6 +7,7 @@ from .resources.pdfs import Pdfs
from
.resources.students
import
Students
from
.resources.submissions
import
Submissions
from
.resources
import
signature
from
.resources.problems
import
Problems
api_bp
=
Blueprint
(
__name__
,
__name__
)
...
...
@@ -27,6 +28,7 @@ api.add_resource(Students, '/students', '/students/<int:student_id>')
api
.
add_resource
(
Submissions
,
'
/submissions/<int:exam_id>
'
,
'
/submissions/<int:exam_id>/<int:submission_id>
'
)
api
.
add_resource
(
Problems
,
'
/problems/<int:exam_id>
'
)
# Other resources that don't return JSON
# It is possible to get flask_restful to work with these, but not
...
...
This diff is collapsed.
Click to expand it.
zesje/resources/problems.py
0 → 100644
+
31
−
0
View file @
f09dd532
"""
REST api for problems
"""
from
flask_restful
import
Resource
from
pony
import
orm
from
..models
import
Exam
,
Problem
class
Problems
(
Resource
):
"""
List of problems associated with a particular exam_id
"""
@orm.db_session
def
get
(
self
,
exam_id
):
"""
get list of problems of exam
Returns
-------
list of:
id: int
name: str
"""
exam
=
Exam
[
exam_id
]
return
[
{
'
id
'
:
problem
.
id
,
'
name
'
:
problem
.
name
}
for
problem
in
Problem
.
select
(
lambda
p
:
p
.
exam
==
exam
)
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment