Skip to content

Commit

Permalink
Merge branch 'staging' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
German Martinez committed Dec 2, 2024
2 parents f32dfe8 + aa3f081 commit 1fb4fdb
Show file tree
Hide file tree
Showing 13 changed files with 101 additions and 118 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/jenkins-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Trigger Jenkins Job

on:
push:
branches:
- '**' # This will trigger the workflow on any branch that receives a push
workflow_dispatch: # This allows the workflow to be manually triggered if needed

jobs:
trigger-job:
runs-on: ubuntu-latest

steps:
# Step 1: Get the branch name and build the URL for Jenkins
- name: Get branch name and build Jenkins URL
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/} # Remove 'refs/heads/' from GITHUB_REF
JENKINS_URL="https://automation.prms.cgiar.org/job/prms-reporting-tool-${BRANCH_NAME}/build"
echo "Jenkins job URL for the branch $BRANCH_NAME is: $JENKINS_URL"
echo "JENKINS_URL=${JENKINS_URL}" >> $GITHUB_ENV
# Step 2: Execute the curl command to trigger the job in Jenkins with the dynamically built URL
- name: Trigger Jenkins Job
run: |
curl -X POST ${{ env.JENKINS_URL }} --user ${{ secrets.JENKINS_USERNAME }}:${{ secrets.JENKINS_API_TOKEN }}
env:
JENKINS_URL: ${{ env.JENKINS_URL }}
JENKINS_USERNAME: ${{ secrets.JENKINS_USERNAME }}
JENKINS_API_TOKEN: ${{ secrets.JENKINS_API_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
<i class="material-icons-round direction_icon" [style]="'rotate:' + (this.comes ? '130deg' : '320deg')"> arrow_right_alt </i>
<div *ngSwitchCase="1">
<div class="title" *ngIf="!notification?.action_area_outcome_id && !notification?.toc_result_id">
Request from {{ notification?.requester_official_code }} to add {{ notification?.approving_official_code }} as a contributor to the result:
Request from {{ notification?.approving_official_code }} to add {{ notification?.requester_official_code }} as a contributor to the result:
</div>

<div class="title" *ngIf="notification?.action_area_outcome_id || notification?.toc_result_id">
{{ notification?.requester_official_code }} requests to be added as a contributor to the result:
{{ notification?.approving_official_code }} requests to be added as a contributor to the result:
</div>

<div class="sub_title" *ngIf="!notification?.action_area_outcome_id && !notification?.toc_result_id">
<strong>({{ notification?.requester_official_code }})</strong> - {{ notification?.result_type_name }} -
<strong>({{ notification?.approving_official_code }})</strong> - {{ notification?.result_type_name }} -

<a class="open_route" target="_blank" rel="noopener noreferrer" [href]="resultUrl(notification)">
(Result code: {{ notification?.result_code }}) {{ notification?.title }}
</a>
</div>

<div class="sub_title" *ngIf="notification?.action_area_outcome_id || notification?.toc_result_id">
<strong>({{ notification?.approving_official_code }})</strong> - {{ notification?.result_type_name }} -
<strong>({{ notification?.requester_official_code }})</strong> - {{ notification?.result_type_name }} -

<a class="open_route" target="_blank" rel="noopener noreferrer" [href]="resultUrl(notification)">
(Result code: {{ notification?.result_code }}) {{ notification?.title }}
Expand Down Expand Up @@ -67,10 +67,10 @@
</div>

<div *ngSwitchCase="2">
<div class="title">{{ notification?.requester_official_code }} requests to be added as a contributor to the result:</div>
<div class="title">{{ notification?.approving_official_code }} requests to be added as a contributor to the result:</div>

<div class="sub_title">
<strong>({{ notification?.approving_official_code }})</strong> - {{ notification?.result_type_name }} -
<strong>({{ notification?.requester_official_code }})</strong> - {{ notification?.result_type_name }} -

<a class="open_route" target="_blank" rel="noopener noreferrer" [href]="resultUrl(notification)">
(Result code: {{ notification?.result_code }}) {{ notification?.title }}
Expand All @@ -84,10 +84,10 @@
</div>

<div *ngSwitchCase="3">
<div class="title">{{ notification?.requester_official_code }} requests to be added as a contributor to the result:</div>
<div class="title">{{ notification?.approving_official_code }} requests to be added as a contributor to the result:</div>

<div class="sub_title">
<strong>({{ notification?.approving_official_code }})</strong> - {{ notification?.result_type_name }} -
<strong>({{ notification?.requester_official_code }})</strong> - {{ notification?.result_type_name }} -

<a class="open_route" target="_blank" rel="noopener noreferrer" [href]="resultUrl(notification)">
(Result code: {{ notification?.result_code }}) {{ notification?.title }}
Expand All @@ -102,7 +102,7 @@

<div *ngSwitchCase="4">
<div class="title">
Request from {{ notification?.requester_official_code }} to {{ notification?.approving_official_code }} to be added as a contributor to the
Request from {{ notification?.approving_official_code }} to {{ notification?.requester_official_code }} to be added as a contributor to the
result:
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ export class NotificationItemInnovationComponent {
requesting = false;
submitter = true;

constructor(public api: ApiService, private shareRequestModalSE: ShareRequestModalService, private retrieveModalSE: RetrieveModalService) {}
constructor(
public api: ApiService,
private shareRequestModalSE: ShareRequestModalService,
private retrieveModalSE: RetrieveModalService
) {}

mapAndAccept(notification) {
if (this.requesting || this.api.rolesSE.platformIsClosed || this.isQAed || !this.notification?.version_status) {
Expand Down Expand Up @@ -59,9 +63,12 @@ export class NotificationItemInnovationComponent {

this.api.dataControlSE.currentResult.result_type = result_type_name;
this.api.dataControlSE.currentNotification = notification;
this.shareRequestModalSE.shareRequestBody.initiative_id = approving_inititiative_id;
this.shareRequestModalSE.shareRequestBody.official_code = approving_official_code;
this.shareRequestModalSE.shareRequestBody.short_name = approving_short_name;
this.shareRequestModalSE.shareRequestBody.initiative_id =
approving_inititiative_id !== owner_initiative_id ? approving_inititiative_id : requester_initiative_id;
this.shareRequestModalSE.shareRequestBody.official_code =
approving_inititiative_id !== owner_initiative_id ? approving_official_code : requester_official_code;
this.shareRequestModalSE.shareRequestBody.short_name =
approving_inititiative_id !== owner_initiative_id ? approving_short_name : requester_short_name;

this.shareRequestModalSE.shareRequestBody.result_toc_results.push({
action_area_outcome_id: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,34 +80,19 @@ <h1 class="partner_item_header-name">
<div class="type">Partner role: <span style="color: #f00">*</span></div>

<div class="deliveries" [ngClass]="{ readOnly_deliveries: this.rolesSE.readOnly }">
<button
class="delivery"
*ngIf="this.rolesSE.readOnly ? this.rdPartnersSE.validateDeliverySelectionPartners(partner?.delivery, 1) : true"
[ngClass]="{ active: this.rdPartnersSE.validateDeliverySelectionPartners(partner?.delivery, 1) }"
(click)="this.rdPartnersSE.onSelectDeliveryPartners(partner, 1)">
Scaling
</button>
<button
class="delivery"
*ngIf="this.rolesSE.readOnly ? this.rdPartnersSE.validateDeliverySelectionPartners(partner?.delivery, 2) : true"
[ngClass]="{ active: this.rdPartnersSE.validateDeliverySelectionPartners(partner?.delivery, 2) }"
(click)="this.rdPartnersSE.onSelectDeliveryPartners(partner, 2)">
Demand
</button>
<button
class="delivery"
*ngIf="this.rolesSE.readOnly ? this.rdPartnersSE.validateDeliverySelectionPartners(partner?.delivery, 3) : true"
[ngClass]="{ active: this.rdPartnersSE.validateDeliverySelectionPartners(partner?.delivery, 3) }"
(click)="this.rdPartnersSE.onSelectDeliveryPartners(partner, 3)">
Innovation
</button>
<button
class="delivery"
*ngIf="this.rolesSE.readOnly ? this.rdPartnersSE.validateDeliverySelectionPartners(partner?.delivery, 4) : true"
[ngClass]="{ active: this.rdPartnersSE.validateDeliverySelectionPartners(partner?.delivery, 4) }"
(click)="this.rdPartnersSE.onSelectDeliveryPartners(partner, 4)">
Other
</button>
@for (delivery of deliveryOptions; track $index) {
<ng-container>
<button
class="delivery"
[ngClass]="{
active: this.rdPartnersSE.validateDeliverySelectionPartners(partner?.delivery, delivery.id),
globalDisabled: this.rolesSE.readOnly
}"
(click)="this.rdPartnersSE.onSelectDeliveryPartners(partner, delivery.id)">
{{ delivery.name }}
</button>
</ng-container>
}
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ export class KnowledgeProductSelectorComponent {

alertStatusMessage: string = `Partner organizations you collaborated with or are currently collaborating with to generate this result. <li>Please note that CGIAR Centers are not listed here. They are directly linked to <a class="open_route" href="/result/result-detail/${this.resultCode}/theory-of-change?phase=${this.versionId}" target="_blank">Section 2, Theory of Change</a>.</li>`;

deliveryOptions = [
{ id: 1, name: 'Scaling' },
{ id: 2, name: 'Demand' },
{ id: 3, name: 'Innovation' },
{ id: 4, name: 'Other' }
];

constructor(
public api: ApiService,
public institutionsSE: InstitutionsService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ export class KnowledgeProductInfoComponent implements OnInit {
mapped.is_peer_reviewed_CG = this.transformBoolean(response.metadataCG?.is_peer_reviewed);
mapped.is_isi_CG = this.transformBoolean(response.metadataCG?.is_isi);
let accessibilityCG: string;
if (!response.metadataCG?.accessibility) {
if (response.metadataCG?.accessibility == null) {
accessibilityCG = 'Not available';
} else {
accessibilityCG = response.metadataCG.accessibility === 'yes' ? 'Open Access' : 'Limited Access';
accessibilityCG = response.metadataCG.accessibility ? 'Open Access' : 'Limited Access';
}
mapped.accessibility_CG = accessibilityCG;
mapped.yearCG = response.metadataCG?.issue_year;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
placeholder="Select Initiative"
description="Select an initiative or platform"
[(ngModel)]="this.theoryOfChangeBody.changePrimaryInit"
[fieldDisabled]="true">
[fieldDisabled]="
!!(this.theoryOfChangeBody.contributing_and_primary_initiative?.length === 1 && this.theoryOfChangeBody?.result_toc_result?.initiative_id)
">
</app-pr-select>

<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,60 +471,6 @@ export class ResultsInnovationPackagesValidationModuleRepository extends Reposit
AND rbi2.is_active = TRUE
)
) THEN FALSE
WHEN (
SELECT
COUNT(*)
FROM
result_ip_expert rie
WHERE
rie.is_active = TRUE
AND rie.result_id = r.id
AND rie.result_ip_expert_id IN (
SELECT
rie2.result_ip_expert_id
FROM
result_ip_expertises rie2
WHERE
rie2.result_ip_expert_id = rie.result_ip_expert_id
AND rie2.is_active = true
)
) = 0 THEN FALSE
WHEN (
SELECT
COUNT(*)
FROM
result_ip_expert rie3
WHERE
rie3.result_id = r.id
AND rie3.is_active = TRUE
AND (
NOT EXISTS (
SELECT
rie4.result_ip_expert_id
FROM
result_ip_expertises rie4
WHERE
rie4.result_ip_expert_id = rie3.result_ip_expert_id
AND rie4.is_active = true
)
)
) > 1 THEN FALSE
WHEN (
SELECT
COUNT(*)
FROM
result_innovation_package rip
WHERE
result_innovation_package_id = r.id
AND is_active = TRUE
AND (
rip.experts_is_diverse IS NULL
OR (
rip.experts_is_diverse = FALSE
AND rip.is_not_diverse_justification IS NULL
)
)
) = 1 THEN FALSE
WHEN (
SELECT
COUNT(*)
Expand Down Expand Up @@ -959,9 +905,7 @@ export class ResultsInnovationPackagesValidationModuleRepository extends Reposit
)
AND(
ripb.current_year IS NULL
OR ripb.current_year = 0
OR ripb.next_year IS NULL
OR ripb.next_year = 0
)
) > 0 THEN FALSE
WHEN (
Expand All @@ -986,9 +930,7 @@ export class ResultsInnovationPackagesValidationModuleRepository extends Reposit
)
AND(
nppb.in_kind IS NULL
OR nppb.in_kind = 0
OR nppb.in_cash IS NULL
OR nppb.in_cash = 0
)
) > 0 THEN FALSE
WHEN (
Expand All @@ -1013,12 +955,9 @@ export class ResultsInnovationPackagesValidationModuleRepository extends Reposit
)
AND (
ribu.in_kind IS NULL
OR ribu.in_kind = 0
OR ribu.in_cash IS NULL
OR ribu.in_cash = 0
)
) > 0 THEN FALSE
WHEN rip.is_result_ip_published IS NULL THEN FALSE
ELSE TRUE
END AS validation
FROM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class PlatformReportService implements OnModuleInit {
) {
try {
const cleanResultCodeInput = Number(result_code);
this._logger.log(`Result to be processed: ${cleanResultCodeInput}`);
if (Number.isNaN(cleanResultCodeInput)) {
const error: returnErrorDto = {
status: 404,
Expand Down Expand Up @@ -257,7 +258,7 @@ export class PlatformReportService implements OnModuleInit {

const fileName =
'PRMS-Result-' +
data.result_code +
cleanResultCodeInput +
'_' +
data.generation_date_filename +
'.pdf';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export class ResultsKnowledgeProductMetadataDto {
source: string;
is_isi: boolean;
accessibility: string;
accessibility: boolean;
issue_year: number;
online_year: number;
doi: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ export class ResultsKnowledgeProductMapper {
});

const keywords =
dto?.agrovoc_keywords?.results ?? dto?.['AGROVOC Keywords'].results ?? [];
dto?.agrovoc_keywords?.results ??
dto?.['AGROVOC Keywords']?.results ??
[];
knowledgeProductDto.keywords = (keywords ?? [])
.filter((k) => !k.is_agrovoc)
.map((k) => k.keyword);
Expand All @@ -92,12 +94,15 @@ export class ResultsKnowledgeProductMapper {
new ResultsKnowledgeProductMetadataDto();

metadataCGSpace.source = 'CGSpace';
metadataCGSpace.accessibility = String(
StringContentComparator.contentCompare(
'Open Access',
dto?.['Open Access'],
) == 0,
);

if (dto?.['Open Access']) {
metadataCGSpace.accessibility =
StringContentComparator.contentCompare(
'Open Access',
dto?.['Open Access'],
) == 0;
}

metadataCGSpace.doi = dto?.DOI;
metadataCGSpace.is_isi =
StringContentComparator.contentCompare('ISI Journal', dto?.ISI) == 0;
Expand All @@ -122,7 +127,13 @@ export class ResultsKnowledgeProductMapper {
new ResultsKnowledgeProductMetadataDto();

metadataWoS.source = mqapDOIData.source;
metadataWoS.accessibility = mqapDOIData.is_oa?.toLocaleLowerCase();

if (mqapDOIData.is_oa) {
metadataWoS.accessibility = mqapDOIData.is_oa
?.toLocaleLowerCase()
?.includes('yes');
}

metadataWoS.doi = mqapDOIData.doi;
metadataWoS.is_isi = mqapDOIData.is_isi
?.toLocaleLowerCase()
Expand Down Expand Up @@ -396,7 +407,9 @@ export class ResultsKnowledgeProductMapper {

metadataDto.source = m.source;

metadataDto.accessibility = m.accesibility;
metadataDto.accessibility = m.accesibility
? m.accesibility === 'yes'
: null;
metadataDto.doi = m.doi;
metadataDto.is_isi = m.is_isi;
metadataDto.is_peer_reviewed = m.is_peer_reviewed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,7 @@ export class resultValidationRepository
# validate that question 29 have been answered if question 33 or 34 have been marked as yes
IF(
(
SELECT 1
SELECT DISTINCT 1
FROM result_questions rq2
JOIN result_answers ra2 ON rq2.result_question_id = ra2.result_question_id
WHERE ra2.result_id = r.id
Expand Down
Loading

0 comments on commit 1fb4fdb

Please sign in to comment.