File tree 1 file changed +30
-2
lines changed 1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -110,8 +110,27 @@ pub async fn handle_dashboard(data: Arc<InputData>) -> ServerResult<dashboard::R
110
110
( _, _) => {
111
111
use std:: cmp:: Ordering ;
112
112
113
- if a. starts_with ( "beta" ) && b. starts_with ( "beta" ) {
114
- a. cmp ( b)
113
+ if a. starts_with ( "beta-" ) && b. starts_with ( "beta-" ) {
114
+ let a_date = a
115
+ . strip_prefix ( "beta-" )
116
+ . unwrap ( )
117
+ . parse :: < chrono:: NaiveDate > ( ) ;
118
+ let b_date = b
119
+ . strip_prefix ( "beta-" )
120
+ . unwrap ( )
121
+ . parse :: < chrono:: NaiveDate > ( ) ;
122
+ if let ( Some ( a) , Some ( b) ) = ( a_date. ok ( ) , b_date. ok ( ) ) {
123
+ a. cmp ( & b)
124
+ } else {
125
+ log:: error!(
126
+ "Parse failed: {:?} => {:?}, {:?} => {:?}" ,
127
+ a,
128
+ a_date,
129
+ b,
130
+ b_date
131
+ ) ;
132
+ Ordering :: Equal
133
+ }
115
134
} else if a. starts_with ( "beta" ) {
116
135
Ordering :: Greater
117
136
} else if b. starts_with ( "beta" ) {
@@ -124,6 +143,15 @@ pub async fn handle_dashboard(data: Arc<InputData>) -> ServerResult<dashboard::R
124
143
}
125
144
}
126
145
} ) ;
146
+ let first_beta = versions. iter ( ) . position ( |v| v. starts_with ( "beta-" ) ) ;
147
+ if let Some ( first_beta) = first_beta {
148
+ let last_beta = versions
149
+ . iter ( )
150
+ . rposition ( |v| v. starts_with ( "beta-" ) )
151
+ . unwrap ( ) ;
152
+ // Remove all but the latest beta version, which is the most recent.
153
+ versions. drain ( first_beta..last_beta) ;
154
+ }
127
155
128
156
let cids = Arc :: new (
129
157
versions
You can’t perform that action at this time.
0 commit comments