Skip to content

Commit

Permalink
Merge pull request #75 from CDLUC3/fixes-for-pilot
Browse files Browse the repository at this point in the history
Fixes for pilot
  • Loading branch information
briri authored Nov 22, 2023
2 parents ead1784 + 1660da5 commit b4d60c3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sam/functions/api/get_awards_nih/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,15 @@ def _transform_response(response_body:)
response_body['results'].map do |result|
next if result['project_title'].nil? || result['appl_id'].nil? || result['principal_investigators'].nil?

contact_pi = result['principal_investigators'].select { |pi| pi['is_contact_pi'] }.first
other_pis = result['principal_investigators'].reject { |pi| pi['is_contact_pi'] }
contact_pi = result.fetch('principal_investigators', []).select { |pi| pi['is_contact_pi'] }&.first
other_pis = result.fetch('principal_investigators', []).reject { |pi| pi['is_contact_pi'] }

{
project: {
title: result['project_title'],
description: result['abstract_text'],
start: result.fetch('project_start_date', '').split('T').first,
end: result.fetch('project_end_date', '').split('T').first,
start: result.fetch('project_start_date', '')&.split('T')&.first,
end: result.fetch('project_end_date', '')&.split('T')&.first,
funding: [
dmproadmap_opportunity_number: result['full_foa'],
dmproadmap_award_amount: result['award_amount'],
Expand Down

0 comments on commit b4d60c3

Please sign in to comment.