File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 6464 scores , prices , scoreToMatch ) {
6565
6666 // the indexes of the solutions with highest scores
67- var bestSolutions = indexesWithValue ( scores , scoreToMatch ) ;
67+ var relevantScoreIndexes = indexesWithValue ( scores , scoreToMatch ) ;
6868
6969 // seed lowestPrice with the first relevant
70- var lowestPrice = prices [ bestSolutions [ 0 ] ] ;
70+ var lowestPrice = prices [ relevantScoreIndexes [ 0 ] ] ;
7171
7272 var cheapestSolutionsWithScore = [ ] ;
7373
74- for ( var i = 0 ; i < bestSolutions . length ; i ++ ) {
75- if ( prices [ bestSolutions [ i ] ] < lowestPrice ) {
74+ for ( var i = 0 ; i < relevantScoreIndexes . length ; i ++ ) {
75+ if ( prices [ relevantScoreIndexes [ i ] ] < lowestPrice ) {
7676 lowestPrice = prices [ i ] ;
7777 }
7878 }
7979
80- for ( var i = 0 ; i < bestSolutions . length ; i ++ ) {
81- if ( prices [ bestSolutions [ i ] ] == lowestPrice ) {
82- cheapestSolutionsWithScore . push ( bestSolutions [ i ] ) ;
80+ for ( var i = 0 ; i < relevantScoreIndexes . length ; i ++ ) {
81+ if ( prices [ relevantScoreIndexes [ i ] ] == lowestPrice ) {
82+ cheapestSolutionsWithScore . push ( relevantScoreIndexes [ i ] ) ;
8383 }
8484 }
8585
You can’t perform that action at this time.
0 commit comments