1
0
Fork 0

RatingService: Remove unnecessary program param

It was kept for postProcessRaterData for now since that would involve
modifying a subtype as well.
master
Mike Gerwitz 2019-10-29 11:43:33 -04:00
parent 65e7880c81
commit cefd6e95cb
1 changed files with 6 additions and 11 deletions

View File

@ -102,8 +102,6 @@ export class RatingService
cmd: string, cmd: string,
): Promise<RateRequestResult> ): Promise<RateRequestResult>
{ {
const program = quote.getProgram();
return new Promise<RateRequestResult>( resolve => return new Promise<RateRequestResult>( resolve =>
{ {
// cmd represents a request for a single rater // cmd represents a request for a single rater
@ -126,11 +124,11 @@ export class RatingService
} ); } );
} }
resolve( this._performRating( request, program, quote, cmd ) ); resolve( this._performRating( request, quote, cmd ) );
} ) } )
.catch( err => .catch( err =>
{ {
this._sendRatingError( request, quote, program, err ); this._sendRatingError( request, quote, err );
throw err; throw err;
} ); } );
} }
@ -172,7 +170,6 @@ export class RatingService
* Perform rating and process result * Perform rating and process result
* *
* @param request - user request to satisfy * @param request - user request to satisfy
* @param program - quote program
* @param quote - quote to process * @param quote - quote to process
* @param indv - individual supplier to rate (or empty) * @param indv - individual supplier to rate (or empty)
* *
@ -180,14 +177,13 @@ export class RatingService
*/ */
private _performRating( private _performRating(
request: UserRequest, request: UserRequest,
program: Program,
quote: ServerSideQuote, quote: ServerSideQuote,
indv: string, indv: string,
): Promise<RateRequestResult> ): Promise<RateRequestResult>
{ {
return new Promise<RateRequestResult>( ( resolve, reject ) => return new Promise<RateRequestResult>( ( resolve, reject ) =>
{ {
var rater = this._rater_manager.byId( program.getId() ); const rater = this._rater_manager.byId( quote.getProgramId() );
this._logger.log( this._logger.PRIORITY_INFO, this._logger.log( this._logger.PRIORITY_INFO,
"Performing '%s' rating for quote #%s", "Performing '%s' rating for quote #%s",
@ -201,7 +197,7 @@ export class RatingService
actions = actions || []; actions = actions || [];
this.postProcessRaterData( this.postProcessRaterData(
request, rate_data, actions, program, quote request, rate_data, actions, quote.getProgram(), quote
); );
const class_dest = {}; const class_dest = {};
@ -235,7 +231,7 @@ export class RatingService
}, },
( message: string ) => ( message: string ) =>
{ {
this._sendRatingError( request, quote, program, this._sendRatingError( request, quote,
Error( message ) Error( message )
); );
@ -376,7 +372,6 @@ export class RatingService
private _sendRatingError( private _sendRatingError(
request: UserRequest, request: UserRequest,
quote: ServerSideQuote, quote: ServerSideQuote,
program: Program,
err: Error, err: Error,
): void ): void
{ {
@ -384,7 +379,7 @@ export class RatingService
this._logger.log( this._logger.PRIORITY_ERROR, this._logger.log( this._logger.PRIORITY_ERROR,
"Rating for quote %d (program %s) failed: %s", "Rating for quote %d (program %s) failed: %s",
quote.getId(), quote.getId(),
program.getId(), quote.getProgramId(),
err.message + '\n-!' + ( err.stack || "" ).replace( /\n/g, '\n-!' ) err.message + '\n-!' + ( err.stack || "" ).replace( /\n/g, '\n-!' )
); );