Fix HLint warnings
This commit is contained in:
@@ -184,4 +184,4 @@ readIndex text = case reads (Text.unpack text) of
|
||||
_ -> Nothing
|
||||
|
||||
overflowProblem :: Text -> Text -> [Word64] -> Problem
|
||||
overflowProblem code message related = Problem code Error ["collection", "costume_overflow"] message related
|
||||
overflowProblem code = Problem code Error ["collection", "costume_overflow"]
|
||||
|
||||
@@ -7,6 +7,7 @@ module BD2.State.Repair.GachaProgress
|
||||
) where
|
||||
|
||||
import BD2.State.Domain
|
||||
import Control.Monad (when)
|
||||
import Data.Foldable (toList)
|
||||
import Data.List (find, sortOn)
|
||||
import qualified Data.Map.Strict as Map
|
||||
@@ -129,7 +130,7 @@ sessionOrder session
|
||||
parseIdentity :: Map.Map Word64 GachaGroupFact -> Text -> Maybe (Word64, Text, Word64, GachaGroupFact)
|
||||
parseIdentity groups identity = do
|
||||
let parts = Text.splitOn ":" identity
|
||||
if length parts < 4 || head parts /= "regular-gacha" then Nothing else pure ()
|
||||
when (length parts < 4 || head parts /= "regular-gacha") Nothing
|
||||
gachaId <- readWord (parts !! 1)
|
||||
fact <- Map.lookup gachaId groups
|
||||
sequenceNumber <- readWord (last parts)
|
||||
|
||||
@@ -11,6 +11,7 @@ import BD2.State.Repair.DuplicateCharacters
|
||||
import BD2.State.Repair.GachaProgress
|
||||
import BD2.State.Repair.NextIndices
|
||||
import BD2.State.Repair.StepUpProgress
|
||||
import Control.Monad (when)
|
||||
import Data.Foldable (toList)
|
||||
import qualified Data.Text as Text
|
||||
import Lens.Family2 ((^.))
|
||||
@@ -24,9 +25,8 @@ repairV1ToCurrent request = do
|
||||
let context = request ^. ControlFields.context
|
||||
source = request ^. ControlFields.source
|
||||
contextVersion = context ^. ControlFields.gameDataVersion
|
||||
if Text.null contextVersion || contextVersion /= source ^. V1Fields.gameDataVersion
|
||||
then Left [Problem "repair.game_data_version" Error ["context", "game_data_version"] "context and source GameData versions differ" []]
|
||||
else pure ()
|
||||
when (Text.null contextVersion || contextVersion /= source ^. V1Fields.gameDataVersion) $
|
||||
Left [Problem "repair.game_data_version" Error ["context", "game_data_version"] "context and source GameData versions differ" []]
|
||||
migrated <- migrateV1ToV2ForRepair source
|
||||
(deduplicated, _) <- repairDuplicateCharacters migrated
|
||||
indexed <- repairNextIndices deduplicated
|
||||
|
||||
@@ -31,7 +31,7 @@ repairStepUpProgress :: StepUpFact -> V2.Snapshot -> Either [Problem] (V2.Snapsh
|
||||
repairStepUpProgress fact snapshot
|
||||
| Text.null (stepUpGameDataVersion fact) || stepUpGameDataVersion fact /= snapshot ^. V2Fields.gameDataVersion =
|
||||
Left [problem "repair.step_up_game_data_version" "step-up design and snapshot GameData versions differ" []]
|
||||
| stepUpGroupId fact == 0 || null (orderedGachaIds fact) || any (== 0) (orderedGachaIds fact) =
|
||||
| stepUpGroupId fact == 0 || null (orderedGachaIds fact) || 0 `elem` orderedGachaIds fact =
|
||||
Left [problem "repair.step_up_invalid_fact" "ordered step-up design must have nonzero IDs" []]
|
||||
| Set.size (Set.fromList (orderedGachaIds fact)) /= length (orderedGachaIds fact) =
|
||||
Left [problem "repair.step_up_duplicate_gacha" "step-up design contains duplicate gacha IDs" (orderedGachaIds fact)]
|
||||
@@ -58,7 +58,7 @@ repairStepUpProgress fact snapshot
|
||||
else Right (snapshot & V2Fields.collection . V2Fields.stepUpProgress .~ repairedEntries, repairedCount)
|
||||
where
|
||||
problem :: Text -> Text -> [Word64] -> Problem
|
||||
problem code message related = Problem code Error ["collection", "step_up_progress"] message related
|
||||
problem code = Problem code Error ["collection", "step_up_progress"]
|
||||
|
||||
newCount :: Text -> Word64 -> V1.NamedCount
|
||||
newCount identity count =
|
||||
|
||||
Reference in New Issue
Block a user