diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2016-02-25 15:56:26 +0100 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2016-02-25 15:56:26 +0100 |
commit | 3f9c073475628db7ae400e0df028b6b066ebf26c (patch) | |
tree | de460dbad672a81339d1516424324ef6997da4af /server/handlers.py | |
parent | e8e0e93719cf276d1d3df6b47c53f30c5ad83ac8 (diff) |
Add a get_solutions(problem_ids) API function
It returns the user’s solutions to given problems.
Diffstat (limited to 'server/handlers.py')
-rw-r--r-- | server/handlers.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/server/handlers.py b/server/handlers.py index f427056..d1ad634 100644 --- a/server/handlers.py +++ b/server/handlers.py @@ -288,6 +288,15 @@ class GetAttempts(CodeqService): request.reply({'code': 0, 'data': request.session.get_attempts(language)}) +class GetSolutions(CodeqService): + def process(self, request): + problem_ids = request.data.get('problem_ids') + if problem_ids is None: + request.reply({'code': 1, 'message': 'No problem IDs specified'}) + else: + request.reply({'code': 0, 'data': request.session.get_solutions(problem_ids)}) + + class GetCurrentSolution(CodeqService): def process(self, request): js = request.data @@ -354,6 +363,7 @@ incoming_handlers = { 'signup': Signup(), 'change_password': ChangePassword(), 'get_attempts': GetAttempts(), + 'get_solutions': GetSolutions(), 'get_current_solution': GetCurrentSolution(), 'logout': Logout(), 'activity': Activity(), |