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

Daniyal/edly 6132 #75

Open
wants to merge 9 commits into
base: develop-koa
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions course_discovery/apps/course_metadata/data_loaders/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,16 @@ def _make_request(self, page):
def _process_response(self, response):
results = response['results']
logger.info('Retrieved %d course runs...', len(results))
logger.info('I am getting called daniyal/EDLY6132')
logger.error('I am error daniyal/EDLY6132')

for body in results:
course_run_id = body['id']

try:
body = self.clean_strings(body)
official_run, draft_run = self.get_course_run(body)
logger.info("invite flag {}".format(body.get('invite_only', 'No Flag Value')))
if official_run or draft_run:
self.update_course_run(official_run, draft_run, body)
if not self.partner.uses_publisher:
Expand Down Expand Up @@ -148,6 +151,7 @@ def get_course_run(self, body):
"""
course_run_key = body['id']
run = CourseRun.objects.filter_drafts(key__iexact=course_run_key).first()
logger.info('Invite Only Flag in get_course_run {}'.format(run.invite_only))
if not run:
return None, None
elif run.draft:
Expand Down Expand Up @@ -187,6 +191,7 @@ def create_course_run(self, course, body):
# Start with draft version and then make official (since our utility functions expect that flow)
defaults['course'] = course.draft_version
draft_run = CourseRun.objects.create(**defaults, draft=True)
logger.info('Invite Only Flag in draft_run {}'.format(draft_run.invite_only))
return draft_run.update_or_create_official_version(notify_services=False)
else:
return CourseRun.objects.create(**defaults)
Expand Down Expand Up @@ -235,12 +240,14 @@ def _update_verified_deadline_for_course_run(self, course_run):
seat.save()

def _update_instance(self, instance, validated_data, **kwargs):
logger.info('Instance {}'.format(instance))
if not instance:
return

updated = False

for attr, value in validated_data.items():
logger.info('Attr with Value {} {}'.format(attr, value))
if getattr(instance, attr) != value:
setattr(instance, attr, value)
updated = True
Expand Down
1 change: 1 addition & 0 deletions course_discovery/apps/edly_discovery_app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def run_dataloader(partner, course_id, service):

dataloader, api_url = pipeline.get(service)
LOGGER.info('Executing Loader [{}]'.format(api_url))
LOGGER.info('Daniyal branch daniyal/EDLY6132')

dataloader(
partner=partner,
Expand Down
Loading