Skip to content

Commit

Permalink
Merge pull request #13 from Meyito/master
Browse files Browse the repository at this point in the history
Listado de problemas por tarea y maraton con informacion acerca de si ya fueron solucionados
  • Loading branch information
Gerson Lázaro authored Oct 30, 2018
2 parents 1146199 + 16c186b commit 336b882
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
17 changes: 16 additions & 1 deletion controllers/assignments.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,22 @@ function get(req, res) {
model: Problem,
as: 'problems',
attributes: ['id', 'title_es', 'title_en', 'level', 'category_id', 'time_limit'],
through: { attributes: ['id'] }
through: { attributes: ['id'] },
include: [
{
model: Submissions,
as: 'submissions',
attributes: ['user_id', 'assignment_problem_id', 'contest_problem_id'],
where: {
user_id: req.user.sub,
verdict: 'Accepted',
assignment_problem_id: {
$ne: null
}
},
required: false
}
]
}
],
attributes: ['id', 'tittle', 'init_date', 'description', 'end_date', 'syllabus_id']
Expand Down
18 changes: 17 additions & 1 deletion controllers/contests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const Contest = require('../models').contests
const ContestProblems = require('../models').contests_problems
const Submissions = require('../models').submissions
const Problem = require('../models').problems
const User = require('../models').users
const ContestStudent = require('../models').contests_students
Expand Down Expand Up @@ -151,7 +152,22 @@ function getProblems(req, res) {
model: Problem,
as: 'problems',
attributes: ['id', 'title_es', 'title_en', 'level'],
through: { attributes: ['id'] }
through: { attributes: ['id'] },
include: [
{
model: Submissions,
as: 'submissions',
attributes: ['id','user_id', 'assignment_problem_id', 'contest_problem_id'],
where: {
user_id: req.user.sub,
verdict: 'Accepted',
contest_problem_id: {
$ne: null
}
},
required: false
}
]
}
]
}).then( (contest) => {
Expand Down

0 comments on commit 336b882

Please sign in to comment.