Skip to content

Commit

Permalink
remove missing console.logs
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-sakuma committed Mar 19, 2024
1 parent cdab8e7 commit c1df306
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
1 change: 0 additions & 1 deletion app/api/graduations/list/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module.exports = async function func() {
).reduce((acc, subject) => {
const category = subject.category
if (!category) {
console.log('no category', subject)
return acc
}
if (!acc[category]) {
Expand Down
23 changes: 10 additions & 13 deletions app/api/graduations/stats/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ module.exports = async function func(context) {
).reduce((acc, subject) => {
const category = subject.category
if (!category) {
console.log('no category', subject)
return acc
}
if (!acc[category]) {
Expand Down Expand Up @@ -72,12 +71,7 @@ module.exports = async function func(context) {
const mandatories = populatedGraduation.subjects.mandatory.filter(
(subject) => {
return enrollments.some((enrollment) => {
if (!enrollment.subject) {
console.log('no subject', enrollment)
return false
}
if (!subject.subject) {
console.log('no subject', subject)
if (!enrollment.subject || !subject.subject) {
return false
}
return (
Expand All @@ -89,12 +83,7 @@ module.exports = async function func(context) {

const limited = populatedGraduation.subjects.limited.filter((subject) => {
return enrollments.some((enrollment) => {
if (!enrollment.subject) {
console.log('no subject', enrollment)
return false
}
if (!subject.subject) {
console.log('no subject', subject)
if (!enrollment.subject || !subject.subject) {
return false
}
return (
Expand All @@ -103,6 +92,8 @@ module.exports = async function func(context) {
})
})

const invalidGrades = ['O', 'F']

return {
percentage: {
mandatories:
Expand All @@ -128,13 +119,19 @@ module.exports = async function func(context) {
missing: {
mandatories: populatedGraduation.subjects.mandatory.filter((subject) => {
return !mandatories.some((enrollment) => {
const completed = !invalidGrades.includes(enrollment.conceito)
if (!completed) return false

return (
enrollment.subject._id.toString() === subject.subject._id.toString()
)
})
}),
limited: populatedGraduation.subjects.limited.filter((subject) => {
return !limited.some((enrollment) => {
const completed = !invalidGrades.includes(enrollment.conceito)
if (!completed) return false

return (
enrollment.subject._id.toString() === subject.subject._id.toString()
)
Expand Down

0 comments on commit c1df306

Please sign in to comment.