File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed
apps/backend/src/datasources/postgres Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -360,11 +360,12 @@ export default class PostgresReviewDataSource implements ReviewDataSource {
360360 qb . where ( 'user_id' , userId ) ;
361361 }
362362
363+ qb . join ( 'proposals' , {
364+ 'proposals.proposal_pk' : 'fap_reviews.proposal_pk' ,
365+ } ) ;
366+
363367 // sometimes the ID 0 is sent as a equivalent of all
364368 if ( callId ) {
365- qb . join ( 'proposals' , {
366- 'proposals.proposal_pk' : 'fap_reviews.proposal_pk' ,
367- } ) ;
368369 qb . where ( 'proposals.call_id' , callId ) ;
369370 }
370371
@@ -381,9 +382,6 @@ export default class PostgresReviewDataSource implements ReviewDataSource {
381382 }
382383
383384 if ( active ) {
384- qb . join ( 'proposals' , {
385- 'proposals.proposal_pk' : 'fap_reviews.proposal_pk' ,
386- } ) ;
387385 qb . join ( 'call' , {
388386 'call.call_id' : 'proposals.call_id' ,
389387 } ) ;
@@ -435,10 +433,10 @@ export default class PostgresReviewDataSource implements ReviewDataSource {
435433 . select ( 'fap_reviews.*' )
436434 . from ( 'fap_reviews' )
437435 . modify ( ( qb ) => {
436+ qb . join ( 'proposals' , {
437+ 'proposals.proposal_pk' : 'fap_reviews.proposal_pk' ,
438+ } ) ;
438439 if ( callId ) {
439- qb . join ( 'proposals' , {
440- 'proposals.proposal_pk' : 'fap_reviews.proposal_pk' ,
441- } ) ;
442440 qb . where ( 'proposals.call_id' , callId ) ;
443441 }
444442 if ( instrumentId ) {
@@ -454,9 +452,6 @@ export default class PostgresReviewDataSource implements ReviewDataSource {
454452 }
455453
456454 if ( active ) {
457- qb . join ( 'proposals' , {
458- 'proposals.proposal_pk' : 'fap_reviews.proposal_pk' ,
459- } ) ;
460455 qb . join ( 'call' , {
461456 'call.call_id' : 'proposals.call_id' ,
462457 } ) ;
You can’t perform that action at this time.
0 commit comments