package Ġcom . jetbrains . edu . learning . step ik . submissions Ċ Ċ import Ġcom . jetbrains . edu . learning . course Format . Check Status Ċ import Ġcom . jetbrains . edu . learning . course Format . tasks . Task Ċ import Ġcom . jetbrains . edu . learning . course Format . tasks . choice . Choice Option Ċ import Ġcom . jetbrains . edu . learning . course Format . tasks . choice . Choice Task Ċ import Ġcom . jetbrains . edu . learning . course Format . tasks . data . Data Task Attempt Ċ import Ġcom . jetbrains . edu . learning . step ik . api .* Ċ import Ġcom . jetbrains . edu . learning . step ik . hyper skill . course Format . Remote E du Task Ċ import Ġcom . jetbrains . edu . learning . submissions . Solution File Ċ Ċ object ĠSte pi k Based Submission Factory Ġ{ ĊĠ Ġ@ Jvm Static ĊĠ Ġfun Ġcreate Code Task Submission ( attempt : ĠAttempt , Ġanswer : ĠString , Ġlanguage : ĠString ): ĠSte pi k Based Submission Ġ{ ĊĠĠĠ Ġval Ġreply Ġ= ĠReply () ĊĠĠĠ Ġreply . code Ġ= Ġanswer ĊĠĠĠ Ġreply . language Ġ= Ġlanguage ĊĠĠĠ Ġreturn ĠSte pi k Based Submission ( attempt , Ġreply ) ĊĠ Ġ} ĊĊĠ Ġfun Ġcreate E du Task Submission ( task : ĠTask , Ġattempt : ĠAttempt , Ġfiles : ĠList < Solution File >, Ġfeedback : ĠString ): ĠSte pi k Based Submission Ġ{ ĊĠĠĠ Ġval Ġreply Ġ= ĠReply () ĊĠĠĠ Ġreply . feedback Ġ= ĠFeedback ( feedback ) ĊĠĠĠ Ġreply . score Ġ= Ġif Ġ( task . status Ġ== ĠCheck Status . S olved ) Ġ" 1 " Ġelse Ġ" 0 " ĊĠĠĠ Ġreply . solution Ġ= Ġfiles ĊĠĠĠ Ġreturn ĠSte pi k Based Submission ( attempt , Ġreply ) ĊĠ Ġ} ĊĊĠ Ġ@ Jvm Static ĊĠ Ġfun Ġcreate Step ik Submission ( task : ĠTask , Ġattempt : ĠAttempt , Ġfiles : ĠList < Solution File > Ġ= Ġempty List ()): ĠSte pi k Based Submission Ġ{ ĊĠĠĠ Ġval ĠobjectMapper Ġ= ĠSte pi k Connector . getInstance (). object Mapper ĊĠĠĠ Ġval Ġserialized Task Ġ= ĠobjectMapper . writeValue AsString ( Task Data ( task )) ĊĊĠĠĠ Ġval Ġreply Ġ= ĠReply () ĊĠĠĠ Ġreply . edu Task Ġ= Ġserialized Task ĊĠĠĠ Ġreply . score Ġ= Ġif Ġ( task . status Ġ== ĠCheck Status . S olved ) Ġ" 1 " Ġelse Ġ" 0 " ĊĠĠĠ Ġreply . solution Ġ= Ġfiles ĊĠĠĠ Ġreturn ĠSte pi k Based Submission ( attempt , Ġreply ) ĊĠ Ġ} ĊĊĠ Ġfun Ġcreate Remote E du Task Submission ( task : ĠRemote E du Task , Ġattempt : ĠAttempt , Ġfiles : ĠList < Solution File >): ĠSte pi k Based Submission Ġ{ ĊĠĠĠ Ġval Ġreply Ġ= ĠReply () ĊĠĠĠ Ġreply . check Profile Ġ= Ġtask . check Profile ĊĠĠĠ Ġreply . solution Ġ= Ġfiles ĊĠĠĠ Ġreturn ĠSte pi k Based Submission ( attempt , Ġreply ) ĊĠ Ġ} ĊĊĠ Ġ@ Jvm Static ĊĠ Ġfun Ġcreate Choice Task Submission ( task : ĠChoice Task , Ġattempt : ĠAttempt ): ĠSte pi k Based Submission Ġ{ ĊĠĠĠ Ġval Ġanswer Array Ġ= Ġcreate Choice Task Answer Array ( task , Ġattempt ) ĊĠĠĠ Ġval Ġreply Ġ= ĠReply () ĊĠĠĠ Ġreply . choices Ġ= Ġanswer Array ĊĠĠĠ Ġreturn ĠSte pi k Based Submission ( attempt , Ġreply ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġcreate Choice Task Answer Array ( task : ĠChoice Task , Ġattempt : ĠAttempt ): ĠBoolean Array Ġ{ ĊĠĠĠ Ġval Ġoptions Ġ= Ġattempt . dataset ?. options ĊĠĠĠ Ġval Ġanswer Ġ= ĠBoolean Array ( task . choice Options . size ) ĊĠĠĠ Ġif Ġ( options Ġ!= Ġnull Ġ&& Ġoptions . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠ Ġ// ĠEvery Ġattempt Ġof Ġchoice Task Ġcan Ġreturn Ġoptions Ġin Ġdifferent Ġorder ĊĠĠĠĠĠ Ġtask . selected Variants ĊĠĠĠĠĠĠĠ Ġ. map Ġ{ Ġselected Index Ġ-> Ġtask . choice Options [ selectedIndex ] Ġ} ĊĠĠĠĠĠĠĠ Ġ. map ( Choice Option :: text ) ĊĠĠĠĠĠĠĠ Ġ. map Ġ{ Ġselected Text Ġ-> Ġoptions . indexOf ( selected Text ) Ġ} ĊĠĠĠĠĠĠĠ Ġ. forEach Ġ{ Ġindex Ġ-> Ġanswer [ index ] Ġ= Ġtrue Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġreturn Ġanswer ĊĠ Ġ} ĊĊĠ Ġfun Ġcreate String Task Submission ( attempt : ĠAttempt , Ġanswer : ĠString ): ĠSte pi k Based Submission Ġ{ ĊĠĠĠ Ġval Ġreply Ġ= ĠReply () ĊĠĠĠ Ġreply . text Ġ= Ġanswer ĊĠĠĠ Ġreturn ĠSte pi k Based Submission ( attempt , Ġreply ) ĊĠ Ġ} ĊĊĠ Ġfun Ġcreate Number Task Submission ( attempt : ĠAttempt , Ġanswer : ĠString ): ĠSte pi k Based Submission Ġ{ ĊĠĠĠ Ġval Ġreply Ġ= ĠReply () ĊĠĠĠ Ġreply . number Ġ= Ġanswer ĊĠĠĠ Ġreturn ĠSte pi k Based Submission ( attempt , Ġreply ) ĊĠ Ġ} ĊĊĠ Ġfun Ġcreate Data Task Submission ( attempt : ĠData Task Attempt , Ġanswer : ĠString ): ĠSte pi k Based Submission Ġ{ ĊĠĠĠ Ġval Ġreply Ġ= ĠReply () ĊĠĠĠ Ġreply . file Ġ= Ġanswer ĊĠĠĠ Ġreturn ĠSte pi k Based Submission ( attempt , Ġreply ) ĊĠ Ġ} Ċ }