File tree Expand file tree Collapse file tree 1 file changed +3
-17
lines changed
src/simulation/investment Expand file tree Collapse file tree 1 file changed +3
-17
lines changed Original file line number Diff line number Diff line change @@ -71,24 +71,10 @@ impl AppraisalOutput {
7171 }
7272}
7373
74+ /// Sort commissioned assets first and newer before older
7475fn compare_asset_fallback ( asset1 : & Asset , asset2 : & Asset ) -> Ordering {
75- // Favour commissioned assets over non-commissioned
76- if asset1. is_commissioned ( ) && !asset2. is_commissioned ( ) {
77- return Ordering :: Less ;
78- }
79- if !asset1. is_commissioned ( ) && asset2. is_commissioned ( ) {
80- return Ordering :: Greater ;
81- }
82-
83- // if both commissioned, favour newer ones
84- if asset1. is_commissioned ( ) && asset2. is_commissioned ( ) {
85- return asset1
86- . commission_year ( )
87- . cmp ( & asset2. commission_year ( ) )
88- . reverse ( ) ;
89- }
90-
91- Ordering :: Equal
76+ ( asset2. is_commissioned ( ) , asset2. commission_year ( ) )
77+ . cmp ( & ( asset1. is_commissioned ( ) , asset1. commission_year ( ) ) )
9278}
9379
9480/// Calculate LCOX for a hypothetical investment in the given asset.
You can’t perform that action at this time.
0 commit comments