Skip to content

Commit

Permalink
Merge pull request #935 from UniversityOfHelsinkiCS/trunk
Browse files Browse the repository at this point in the history
Fix student graph
  • Loading branch information
Rochet2 authored May 24, 2019
2 parents 8325acb + 9604fdf commit 6909609
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 10 deletions.
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

0 comments on commit 6909609

Please sign in to comment.