package Ġcom . jetbrains . edu . learning . step ik . checker Ċ Ċ import Ġcom . intellij . openapi . diagnostic . Logger Ċ import Ġcom . intellij . openapi . diagnostic . logger Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . jetbrains . edu . learning . Err Ċ import Ġcom . jetbrains . edu . learning . Ok Ċ import Ġcom . jetbrains . edu . learning . Result Ċ import Ġcom . jetbrains . edu . learning . course Format . ext . configur ator Ċ import Ġcom . jetbrains . edu . learning . course Format . ext . getText Ċ import Ġcom . jetbrains . edu . learning . course Format . ext . language DisplayName Ċ import Ġcom . jetbrains . edu . learning . course Format . tasks . Answer Task Ċ import Ġcom . jetbrains . edu . learning . course Format . tasks . Code Task Ċ import Ġcom . jetbrains . edu . learning . course Format . tasks . Number Task Ċ import Ġcom . jetbrains . edu . learning . course Format . tasks . String Task Ċ import Ġcom . jetbrains . edu . learning . course Format . tasks . choice . Choice Task Ċ import Ġcom . jetbrains . edu . learning . course Format . tasks . data . Data Task Ċ import Ġcom . jetbrains . edu . learning . messages . E du Core Bundle Ċ import Ġcom . jetbrains . edu . learning . onError Ċ import Ġcom . jetbrains . edu . learning . step ik . Step ik Language Ċ import Ġcom . jetbrains . edu . learning . step ik . api . Step ik Based Connector . Companion . get Step ik Based Connector Ċ import Ġcom . jetbrains . edu . learning . step ik . api . Step ik Based Submission Ċ import Ġcom . jetbrains . edu . learning . step ik . hyper skill . Hyper skill Languages Ċ import Ġcom . jetbrains . edu . learning . step ik . hyper skill . api . Hyper skill Connector Ċ import Ġcom . jetbrains . edu . learning . step ik . hyper skill . course Format . Hyper skill Course Ċ import Ġcom . jetbrains . edu . learning . step ik . hyper skill . course Format . Remote E du Task Ċ import Ġcom . jetbrains . edu . learning . step ik . submissions . Step ik Based Submission Factory Ċ import Ġcom . jetbrains . edu . learning . submissions . Solution File Ċ Ċ object ĠSte pi k Based Submit Connector Ġ{ ĊĠ Ġfun Ġsubmit Code Task ( project : ĠProject , Ġtask : ĠCode Task ): ĠResult < Step ik Based Submission , ĠString > Ġ{ ĊĠĠĠ Ġval Ġconnector Ġ= Ġtask . get Step ik Based Connector () ĊĠĠĠ Ġval Ġattempt Ġ= Ġconnector . post Attempt ( task ). onError Ġ{ ĊĠĠĠĠĠ Ġreturn ĠErr ( it ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġdefault Language Ġ= Ġget Language ( task ). onError Ġ{ ĊĠĠĠĠĠ Ġreturn ĠErr ( it ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġconfigur ator Ġ= Ġtask . course . configur ator ĊĠĠĠ Ġval Ġcode Task Text Ġ= Ġconfigur ator ?. getCode Task File ( project , Ġtask )?. getText ( project ) ĊĠĠĠ Ġif Ġ( code Task Text Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠ ĠLOG . error (" Unable Ġto Ġcreate Ġsubmission : Ġfile Ġwith Ġcode Ġis Ġnot Ġfound Ġfor Ġthe Ġtask Ġ${ task . name }") ĊĠĠĠĠĠ Ġreturn ĠErr ( E du Core Bundle . message (" error . failed . to . post . solution ", Ġconnector . platform Name )) ĊĠĠĠ Ġ} ĊĠĠĠ Ġval Ġsubmission Ġ= ĠSte pi k Based Submission Factory . create Code Task Submission ( attempt , Ġcode Task Text , Ġdefault Language ) ĊĠĠĠ Ġreturn Ġconnector . post Submission ( submission ) ĊĠ Ġ} ĊĊĠ Ġ// Ġwill Ġbe Ġfixed Ġor Ġremoved Ġin ĠE DU - 4 7 8 1 ĊĠ Ġprivate Ġfun Ġget Language ( task : ĠCode Task ): ĠResult < String , ĠString > Ġ{ ĊĠĠĠ Ġval Ġcourse Ġ= Ġtask . course ĊĠĠĠ Ġreturn Ġwhen Ġ{ ĊĠĠĠĠĠ Ġcourse Ġis ĠHyper skill Course Ġ-> Ġget Hyper skill Language ( task ) ĊĠĠĠĠĠ Ġcourse . is Step ik Remote Ġ-> Ġget Step ik Language ( task ) ĊĠĠĠĠĠ Ġelse Ġ-> Ġerror (" Task Ġ${ task . name } Ġdoesn 't Ġbelong Ġto ĠHyper skill Ġnor ĠSte pi k Ġcourses ") ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġget Hyper skill Language ( task : ĠCode Task ): ĠResult < String , ĠString > Ġ{ ĊĠĠĠ Ġval Ġcourse Ġ= Ġtask . course ĊĠĠĠ Ġval Ġdefault Language Ġ= ĠHyper skill Languages . get Language Name ( course . language ID ) ĊĠĠĠ Ġif Ġ( default Language Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠ Ġval Ġlanguage DisplayName Ġ= Ġcourse . language DisplayName ĊĠĠĠĠĠ Ġreturn ĠErr (""" Unknown Ġlanguage Ġ"$ language DisplayName ". ĠCheck Ġif Ġsupport Ġfor Ġ"$ language DisplayName " Ġis Ġenabled . """) ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn ĠOk ( default Language ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġget Step ik Language ( task : ĠCode Task ): ĠResult < String , ĠString > Ġ{ ĊĠĠĠ Ġval Ġcourse Ġ= Ġtask . course ĊĊĠĠĠ Ġval Ġcourse Language Id Ġ= Ġcourse . language ById ?. id ĊĠĠĠ Ġif Ġ( course Language Id Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠ Ġval Ġdefault Language Ġ= ĠSte pi k Language . lang Of Id ( course Language Id , Ġcourse . language Version ). lang Name ĊĠĠĠĠĠ Ġif Ġ( default Language Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠOk ( default Language ) ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġlanguage DisplayName Ġ= Ġcourse . language DisplayName ĊĠĠĠ Ġreturn ĠErr (""" Unknown Ġlanguage Ġ"$ language DisplayName ". ĠCheck Ġif Ġsupport Ġfor Ġ"$ language DisplayName " Ġis Ġenabled . """) ĊĠ Ġ} ĊĊĠ Ġfun Ġsubmit Choice Task ( task : ĠChoice Task ): ĠResult < Step ik Based Submission , ĠString > Ġ{ ĊĠĠĠ Ġval Ġconnector Ġ= Ġtask . get Step ik Based Connector () ĊĠĠĠ Ġval Ġattempt Ġ= Ġconnector . getActive Attempt Or Post New ( task ). onError Ġ{ ĊĠĠĠĠĠ Ġreturn ĠErr ( it ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġsubmission Ġ= ĠSte pi k Based Submission Factory . create Choice Task Submission ( task , Ġattempt ) ĊĠĠĠ Ġreturn Ġconnector . post Submission ( submission ) ĊĠ Ġ} ĊĊĠ Ġfun Ġsubmit Data Task ( task : ĠData Task , Ġanswer : ĠString ): ĠResult < Step ik Based Submission , ĠString > Ġ{ ĊĠĠĠ Ġval Ġattempt Ġ= Ġtask . attempt Ġ?: Ġreturn ĠErr (" Imp ossible Ġto Ġsubmit Ġdata Ġtask Ġwithout Ġactive Ġattempt ") ĊĠĠĠ Ġval Ġconnector Ġ= Ġtask . get Step ik Based Connector () ĊĠĠĠ Ġval Ġsubmission Ġ= ĠSte pi k Based Submission Factory . create Data Task Submission ( attempt , Ġanswer ) ĊĠĠĠ Ġreturn Ġconnector . post Submission ( submission ) ĊĠ Ġ} ĊĊĠ Ġfun Ġsubmit Answer Task ( project : ĠProject , Ġtask : ĠAnswer Task ): ĠResult < Step ik Based Submission , ĠString > Ġ{ ĊĠĠĠ Ġval Ġconnector Ġ= Ġtask . get Step ik Based Connector () ĊĠĠĠ Ġval Ġattempt Ġ= Ġconnector . post Attempt ( task ). onError Ġ{ ĊĠĠĠĠĠ Ġreturn ĠErr ( it ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġsubmission Ġ= Ġwhen Ġ( task ) Ġ{ ĊĠĠĠĠĠ Ġis ĠString Task Ġ-> ĠSte pi k Based Submission Factory . create String Task Submission ( attempt , Ġtask . getInput Answer ( project )) ĊĠĠĠĠĠ Ġis ĠNumber Task Ġ-> ĠSte pi k Based Submission Factory . create Number Task Submission ( attempt , Ġtask . getInput Answer ( project )) ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġconnector . post Submission ( submission ) ĊĠ Ġ} ĊĊĠ Ġfun Ġsubmit Remote E du Task ( task : ĠRemote E du Task , Ġfiles : ĠList < Solution File >): ĠResult < Step ik Based Submission , ĠString > Ġ{ ĊĠĠĠ Ġval Ġconnector Ġ= ĠHyper skill Connector . getInstance () ĊĠĠĠ Ġval Ġattempt Ġ= Ġconnector . post Attempt ( task ). onError Ġ{ ĊĠĠĠĠĠ Ġreturn ĠErr ( it ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġtask Submission Ġ= ĠSte pi k Based Submission Factory . create Remote E du Task Submission ( task , Ġattempt , Ġfiles ) ĊĠĠĠ Ġreturn Ġconnector . post Submission ( task Submission ) ĊĠ Ġ} ĊĊĠ Ġ@ Jvm Static ĊĠ Ġprivate Ġval ĠLOG : ĠLogger Ġ= Ġlogger < Step ik Based Submit Connector >() Ċ }