Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix student graph #935

Merged
merged 4 commits into from
May 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker-compose.lateste2e.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ services:
depends_on:
- db
- redis
- nats

frontend:
image: toska/oodikone2-frontend:latest
Expand Down
1 change: 1 addition & 0 deletions docker-compose.lateste2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ services:
depends_on:
- db
- redis
- nats

frontend:
image: toska/oodikone2-frontend:staging
Expand Down
7 changes: 2 additions & 5 deletions services/backend/updater_writer/updater/database_updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const updateAttainments = (studyAttainments, transaction) => studyAttainments.ma
creditTeachers.length > 0 && Promise.all(creditTeachers.map(cT => CreditTeacher.upsert(cT, { transaction })))
])
} catch (e) {
console.log(e)
console.log('attainment update failed', e)
}
})

Expand All @@ -61,12 +61,9 @@ const updateStudent = async (student) => {
await deleteStudentStudyrights(studentInfo.studentnumber, transaction) // this needs to be done because Oodi just deletes deprecated studyrights from students ( big yikes )

await Student.upsert(studentInfo, { transaction })
try {
await Promise.all(semesterEnrollments.map(SE =>
SemesterEnrollment.upsert(SE, { transaction })))
} catch(e) {
console.log(e)
}

if (studyAttainments) await Promise.all(updateAttainments(studyAttainments, transaction))

if (studyRights) await Promise.all(updateStudyRights(studyRights, transaction))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class CreditAccumulationGraph extends Component {
.filter(c => moment(c.date).isSameOrAfter(moment(startDate)))

let totalCredits = 0
return filteredCourses.map((c) => {
return _.orderBy(filteredCourses, ['date'], ['asc']).map((c) => {
const {
course, date, credits, grade, passed, isStudyModuleCredit
} = c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const attemptGetFor = async (url, attempts = 5) => {
attempt += 1
try {
response = await getUrl(url)
logger.info('requested url', { url, status: response.status })
logger.info('requested url', { url, success: response.status === 200 })
return response
} catch (error) {
if (attempt === attempts) {
Expand All @@ -63,7 +63,7 @@ console.log(process.env.NODE_ENV)
const getStudent = async studentNumber => {
const url = `${base_url}/students/${studentNumber}/info`
try {
const response = await getUrl(url)
const response = await attemptGetFor(url)
const data = response.data.data
return data
} catch (e) {
Expand Down
2 changes: 0 additions & 2 deletions services/updater_api/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ if (process.env.NODE_ENV !== 'test') {
transports.push(new winston.transports.File({ filename: 'debug.log' }))
}

transports.push(new winston.transports.Console({ level: 'debug' }))


const logger = winston.createLogger({ transports })

Expand Down