@@ -9,7 +9,7 @@ use pointercrate_core_api::{
99 error:: Result ,
1010 response:: { Page , Response2 } ,
1111} ;
12- use pointercrate_demonlist:: player:: claim:: PlayerClaim ;
12+ use pointercrate_demonlist:: player:: { claim:: PlayerClaim , DatabasePlayer } ;
1313use pointercrate_demonlist:: player:: { FullPlayer , Player } ;
1414use pointercrate_demonlist:: {
1515 demon:: { audit:: audit_log_for_demon, current_list, list_at, FullDemon , MinimalDemon } ,
@@ -22,6 +22,7 @@ use pointercrate_demonlist_pages::{
2222 demon_page:: { DemonMovement , DemonPage } ,
2323 overview:: OverviewPage ,
2424 statsviewer:: individual:: IndividualStatsViewer ,
25+ submit_record:: SubmitRecordPage ,
2526} ;
2627use pointercrate_integrate:: gd:: GeometryDashConnector ;
2728use pointercrate_user:: auth:: NonMutating ;
@@ -32,10 +33,9 @@ use rocket::{futures::StreamExt, http::CookieJar};
3233use sqlx:: PgConnection ;
3334
3435#[ localized]
35- #[ rocket:: get( "/?<timemachine>&<submitter> " ) ]
36+ #[ rocket:: get( "/?<timemachine>" ) ]
3637pub async fn overview (
37- pool : & State < PointercratePool > , timemachine : Option < bool > , submitter : Option < bool > , cookies : & CookieJar < ' _ > ,
38- auth : Option < Auth < NonMutating > > ,
38+ pool : & State < PointercratePool > , timemachine : Option < bool > , cookies : & CookieJar < ' _ > , auth : Option < Auth < NonMutating > > ,
3939) -> Result < Page > {
4040 // A few months before pointercrate first went live - definitely the oldest data we have
4141 let beginning_of_time = NaiveDate :: from_ymd_opt ( 2017 , 1 , 4 ) . unwrap ( ) . and_hms_opt ( 0 , 0 , 0 ) . unwrap ( ) ;
@@ -44,6 +44,8 @@ pub async fn overview(
4444
4545 let demonlist = current_list ( & mut connection) . await ?;
4646
47+ dbg ! ( & demonlist) ;
48+
4749 let mut specified_when = cookies
4850 . get ( "when" )
4951 . and_then ( |cookie| DateTime :: < FixedOffset > :: parse_from_rfc3339 ( cookie. value ( ) ) . ok ( ) ) ;
@@ -84,7 +86,6 @@ pub async fn overview(
8486 } ,
8587 demonlist,
8688 time_machine : tardis,
87- submitter_initially_visible : submitter. unwrap_or ( false ) ,
8889 claimed_player : match auth {
8990 Some ( auth) => claimed_full_player ( auth. user . user ( ) , & mut connection) . await ,
9091 None => None ,
@@ -236,3 +237,22 @@ fn make_css_rule(code: &str, score: f64, highest_score: f64) -> String {
236237 0xe0 as f64 + ( 0xc6 - 0xe0 ) as f64 * ( score / highest_score) ,
237238 )
238239}
240+
241+ #[ localized]
242+ #[ rocket:: get( "/submit-record?<demon>" ) ]
243+ pub async fn submit_record ( pool : & State < PointercratePool > , demon : Option < usize > , auth : Option < Auth < NonMutating > > ) -> Result < Page > {
244+ let mut connection = pool. connection ( ) . await ?;
245+
246+ let demons = current_list ( & mut connection) . await ?;
247+
248+ let claimed_player = match auth {
249+ Some ( auth) => DatabasePlayer :: by_user ( auth. user . user ( ) . id , & mut connection) . await . unwrap_or ( None ) ,
250+ None => None ,
251+ } ;
252+
253+ Ok ( Page :: new ( SubmitRecordPage {
254+ demons,
255+ initial_demon : demon,
256+ initial_holder : claimed_player,
257+ } ) )
258+ }
0 commit comments