Skip to content

Commit 43d4251

Browse files
committed
infer rank on submit
1 parent 7b16e2e commit 43d4251

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

core/AOC/Run.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ mainSubmit CB{..} Cfg{..} MSO{..} = do
269269
cd@CD{..} <- liftIO $ challengeData _cfgSession _cbYear cs
270270
inp <- liftEither . first ("[PROMPT ERROR]" :) $ _cdInput
271271
opts <-
272-
defaultAoCOpts aocUserAgent _cbYear
272+
defaultAoCOpts' _cbYear
273273
<$> maybeToEither
274274
["ERROR: Session Key Required to Submit"]
275275
_cfgSession

core/AOC/Run/Load.hs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ module AOC.Run.Load (
3434
dayInt,
3535
TestMeta (..),
3636
aocUserAgent,
37+
defaultAoCOpts',
3738

3839
-- * Parsers
3940
parseMeta,
@@ -125,6 +126,9 @@ makeChallengeDirs CP{..} =
125126
(createDirectoryIfMissing True . takeDirectory)
126127
[_cpPrompt, _cpCodeBlocks, _cpInput, _cpAnswer, _cpTests, _cpLog]
127128

129+
defaultAoCOpts' :: Integer -> String -> AoCOpts
130+
defaultAoCOpts' y s = (defaultAoCOpts aocUserAgent y s) { _aInferRankOnSubmission = True }
131+
128132
-- | Load data associated with a challenge from a given specification.
129133
-- Will fetch answers online and cache if required (and if giten a session
130134
-- token).
@@ -183,7 +187,7 @@ challengeData sess yr spec@CS{..} = do
183187
maybeToEither
184188
["Session key needed to fetch input"]
185189
sess
186-
let opts = defaultAoCOpts aocUserAgent yr s
190+
let opts = defaultAoCOpts' yr s
187191
inp <-
188192
liftEither . bimap showAoCError T.unpack
189193
=<< liftIO (runAoC opts a)
@@ -204,7 +208,7 @@ challengeData sess yr spec@CS{..} = do
204208
liftIO $ T.writeFile _cpPrompt prompt
205209
pure prompt
206210
where
207-
opts = defaultAoCOpts aocUserAgent yr $ fold sess
211+
opts = defaultAoCOpts' yr $ fold sess
208212
a = AoCPrompt _csDay
209213
e = case sess of
210214
Just _ -> "Part not yet released"
@@ -222,7 +226,7 @@ challengeData sess yr spec@CS{..} = do
222226
liftIO $ T.writeFile _cpCodeBlocks $ T.intercalate codeBlockSep blocks
223227
pure blocks
224228
where
225-
opts = defaultAoCOpts aocUserAgent yr $ fold sess
229+
opts = defaultAoCOpts' yr $ fold sess
226230
a = AoCPrompt _csDay
227231
e = case sess of
228232
Just _ -> "Part not yet released"

0 commit comments

Comments
 (0)