Skip to content

Commit

Permalink
Only fetch not registered completions from new mooc api by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Keskimaki committed Nov 9, 2023
1 parent ecfbac5 commit 7c60e5a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/services/newMooc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const logger = require('@utils/logger')
const newMoocApi = require('../config/newMoocApi')

const getCompletions = async (course) => {
const getCompletions = async (course, registeredIncluded = false) => {
logger.info({ message: `Fetching completions for course ${course}` })

const { data } = await newMoocApi.get(`/study-registry/completions/${course}`)
const { data } = registeredIncluded
? await newMoocApi.get(`/study-registry/completions/${course}`)
: await newMoocApi.get(`/study-registry/completions/${course}?exclude_already_registered=true`)

logger.info({ message: `Found total of ${data ? data.length : 0} completions` })
return data
Expand Down

0 comments on commit 7c60e5a

Please sign in to comment.