11use anyhow:: Result ;
2- use unix_utils:: { request:: UnixRequestData , response:: UnixResponseData , SnapshotData , UnixError } ;
2+ use unix_utils:: {
3+ request:: UnixRequestData ,
4+ response:: { PossibleRound , UnixResponseData } ,
5+ SnapshotData , UnixError ,
6+ } ;
37
48#[ derive( Debug ) ]
59#[ allow( dead_code) ]
@@ -11,6 +15,7 @@ pub struct CompetitorInfo {
1115 pub country_iso2 : Option < String > ,
1216 pub gender : String ,
1317 pub can_compete : bool ,
18+ pub possible_rounds : Vec < PossibleRound > ,
1419}
1520
1621pub async fn get_competitor_info ( card_id : u64 ) -> Result < CompetitorInfo , UnixError > {
@@ -28,6 +33,7 @@ pub async fn get_competitor_info(card_id: u64) -> Result<CompetitorInfo, UnixErr
2833 country_iso2,
2934 gender,
3035 can_compete,
36+ possible_rounds,
3137 } = res
3238 {
3339 return Ok ( CompetitorInfo {
@@ -38,6 +44,26 @@ pub async fn get_competitor_info(card_id: u64) -> Result<CompetitorInfo, UnixErr
3844 country_iso2,
3945 gender,
4046 can_compete,
47+ possible_rounds : possible_rounds. unwrap_or (
48+ [
49+ PossibleRound {
50+ id : "333-r1" . to_string ( ) ,
51+ name : "3x3 R1" . to_string ( ) ,
52+ use_inspection : true ,
53+ } ,
54+ PossibleRound {
55+ id : "222-r1" . to_string ( ) ,
56+ name : "2x2 R1" . to_string ( ) ,
57+ use_inspection : true ,
58+ } ,
59+ PossibleRound {
60+ id : "other" . to_string ( ) ,
61+ name : "Other room" . to_string ( ) ,
62+ use_inspection : false ,
63+ } ,
64+ ]
65+ . to_vec ( ) ,
66+ ) ,
4167 } ) ;
4268 }
4369
@@ -84,6 +110,7 @@ pub async fn send_solve_entry(
84110 is_delegate : bool ,
85111 session_id : & str ,
86112 inspection_time : i64 ,
113+ round_id : & str ,
87114) -> Result < ( ) , UnixError > {
88115 let solved_at = chrono:: DateTime :: from_timestamp_millis ( solved_at as i64 * 1000 )
89116 . ok_or_else ( || UnixError {
@@ -103,6 +130,7 @@ pub async fn send_solve_entry(
103130 is_delegate,
104131 session_id : session_id. to_string ( ) ,
105132 inspection_time,
133+ round_id : round_id. to_string ( ) ,
106134 } ;
107135
108136 let res = crate :: UNIX_SOCKET
0 commit comments