Typo: recurrance -> recurrence
authorYaroslav Halchenko <debian@onerussian.com>
Tue, 14 Mar 2023 02:35:54 +0000 (22:35 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 17 Mar 2023 19:14:54 +0000 (15:14 -0400)
Assistant/WebApp/Configurators/Fsck.hs
Utility/Scheduled.hs
Utility/Scheduled/QuickCheck.hs
templates/configurators/fsck/formcontent.hamlet

index ee6ab1d91be1983fb7dc0a319f4eb395fe83eb79..e220d34b44b9ac459b167513ff1ccc31d47c88bc 100644 (file)
@@ -67,14 +67,14 @@ runFsckForm new activity = case activity of
                        (reposRes, reposView) <- mreq (selectFieldList repolist) (bfs "") (Just ru)
                        (durationRes, durationView) <- mreq intField (bfs "") (Just $ durationSeconds d `quot` 60 )
                        (timeRes, timeView) <- mreq (selectFieldList times) (bfs "") (Just t)
-                       (recurranceRes, recurranceView) <- mreq (selectFieldList recurrances) (bfs "") (Just r)
+                       (recurrenceRes, recurrenceView) <- mreq (selectFieldList recurrences) (bfs "") (Just r)
                        let form = do
                                webAppFormAuthToken
                                $(widgetFile "configurators/fsck/formcontent")
                        let formresult = mkFsck
                                <$> pure u
                                <*> reposRes
-                               <*> (Schedule <$> recurranceRes <*> timeRes)
+                               <*> (Schedule <$> recurrenceRes <*> timeRes)
                                <*> (Duration <$> ((60 *) <$> durationRes))
                        return (formresult, form)
          where
@@ -82,8 +82,8 @@ runFsckForm new activity = case activity of
                times = ensurevalue t (T.pack $ fromScheduledTime t) $
                        map (\x -> (T.pack $ fromScheduledTime x, x)) $
                                AnyTime : map (\h -> SpecificTime h 0) [0..23]
-               recurrances :: [(Text, Recurrance)]
-               recurrances = ensurevalue r (T.pack $ fromRecurrance r) $
+               recurrences :: [(Text, Recurrence)]
+               recurrences = ensurevalue r (T.pack $ fromRecurrence r) $
                        [ ("every day", Daily)
                        , ("every Sunday", Weekly $ Just 1)
                        , ("every Monday", Weekly $ Just 2)
index dfaeb7ff40dbcd435114c91f77929cbd7672ed0a..7dacdc7ec6061deba7962dc3f7e176aad7605547 100644 (file)
@@ -7,7 +7,7 @@
 
 module Utility.Scheduled (
        Schedule(..),
-       Recurrance(..),
+       Recurrence(..),
        ScheduledTime(..),
        NextTime(..),
        WeekDay,
@@ -19,8 +19,8 @@ module Utility.Scheduled (
        fromSchedule,
        fromScheduledTime,
        toScheduledTime,
-       fromRecurrance,
-       toRecurrance,
+       fromRecurrence,
+       toRecurrence,
        toSchedule,
        parseSchedule,
        prop_past_sane,
@@ -44,15 +44,15 @@ import Control.Applicative
 import Prelude
 
 {- Some sort of scheduled event. -}
-data Schedule = Schedule Recurrance ScheduledTime
+data Schedule = Schedule Recurrence ScheduledTime
        deriving (Eq, Read, Show, Ord)
 
-data Recurrance
+data Recurrence
        = Daily
        | Weekly (Maybe WeekDay)
        | Monthly (Maybe MonthDay)
        | Yearly (Maybe YearDay)
-       | Divisible Int Recurrance
+       | Divisible Int Recurrence
        -- ^ Days, Weeks, or Months of the year evenly divisible by a number.
        -- (Divisible Year is years evenly divisible by a number.)
        deriving (Eq, Read, Show, Ord)
@@ -89,7 +89,7 @@ nextTime schedule lasttime = do
 -- | Calculate the next time that fits a Schedule, based on the
 -- last time it occurred, and the current time.
 calcNextTime :: Schedule -> Maybe LocalTime -> LocalTime -> Maybe NextTime
-calcNextTime schedule@(Schedule recurrance scheduledtime) lasttime currenttime
+calcNextTime schedule@(Schedule recurrence scheduledtime) lasttime currenttime
        | scheduledtime == AnyTime = do
                next <- findfromtoday True
                return $ case next of
@@ -97,7 +97,7 @@ calcNextTime schedule@(Schedule recurrance scheduledtime) lasttime currenttime
                        NextTimeExactly t -> window (localDay t) (localDay t)
        | otherwise = NextTimeExactly . startTime <$> findfromtoday False
   where
-       findfromtoday anytime = findfrom recurrance afterday today
+       findfromtoday anytime = findfrom recurrence afterday today
          where
                today = localDay currenttime
                afterday = sameaslastrun || toolatetoday
@@ -225,24 +225,24 @@ maxmnum = 12
 maxwday :: Int
 maxwday = 7
 
-fromRecurrance :: Recurrance -> String
-fromRecurrance (Divisible n r) =
-       fromRecurrance' (++ "s divisible by " ++ show n) r
-fromRecurrance r = fromRecurrance' ("every " ++) r
+fromRecurrence :: Recurrence -> String
+fromRecurrence (Divisible n r) =
+       fromRecurrence' (++ "s divisible by " ++ show n) r
+fromRecurrence r = fromRecurrence' ("every " ++) r
 
-fromRecurrance' :: (String -> String) -> Recurrance -> String
-fromRecurrance' a Daily = a "day"
-fromRecurrance' a (Weekly n) = onday n (a "week")
-fromRecurrance' a (Monthly n) = onday n (a "month")
-fromRecurrance' a (Yearly n) = onday n (a "year")
-fromRecurrance' a (Divisible _n r) = fromRecurrance' a r -- not used
+fromRecurrence' :: (String -> String) -> Recurrence -> String
+fromRecurrence' a Daily = a "day"
+fromRecurrence' a (Weekly n) = onday n (a "week")
+fromRecurrence' a (Monthly n) = onday n (a "month")
+fromRecurrence' a (Yearly n) = onday n (a "year")
+fromRecurrence' a (Divisible _n r) = fromRecurrence' a r -- not used
 
 onday :: Maybe Int -> String -> String
 onday (Just n) s = "on day " ++ show n ++ " of " ++ s
 onday Nothing s = s
 
-toRecurrance :: String -> Maybe Recurrance
-toRecurrance s = case words s of
+toRecurrence :: String -> Maybe Recurrence
+toRecurrence s = case words s of
        ("every":"day":[]) -> Just Daily
        ("on":"day":sd:"of":"every":something:[]) -> withday sd something
        ("every":something:[]) -> noday something
@@ -316,8 +316,8 @@ toScheduledTime v = case words v of
                        <*> if null m then Just 0 else readish m
 
 fromSchedule :: Schedule -> String
-fromSchedule (Schedule recurrance scheduledtime) = unwords
-       [ fromRecurrance recurrance
+fromSchedule (Schedule recurrence scheduledtime) = unwords
+       [ fromRecurrence recurrence
        , "at"
        , fromScheduledTime scheduledtime
        ]
@@ -327,14 +327,14 @@ toSchedule = eitherToMaybe . parseSchedule
 
 parseSchedule :: String -> Either String Schedule
 parseSchedule s = do
-       r <- maybe (Left $ "bad recurrance: " ++ recurrance) Right
-               (toRecurrance recurrance)
+       r <- maybe (Left $ "bad recurrence: " ++ recurrence) Right
+               (toRecurrence recurrence)
        t <- maybe (Left $ "bad time of day: " ++ scheduledtime) Right
                (toScheduledTime scheduledtime)
        Right $ Schedule r t
   where
        (rws, tws) = separate (== "at") (words s)
-       recurrance = unwords rws
+       recurrence = unwords rws
        scheduledtime = unwords tws
 
 prop_past_sane :: Bool
index 96ce046c30ae08bdf174fe257f452f4263b92da9..c8d4955af755cef666c4cff6c591134a0efcc0cf 100644 (file)
@@ -26,7 +26,7 @@ instance Arbitrary ScheduledTime where
                        <*> choose (1, 59)
                ]
 
-instance Arbitrary Recurrance where
+instance Arbitrary Recurrence where
        arbitrary = oneof
                [ pure Daily
                , Weekly <$> arbday
index 6efa4f37eac84310e95186b32dcdadbe3732d8c5..f1506946ece818c04b9260a9f71e9c0713dfb2bd 100644 (file)
@@ -7,7 +7,7 @@
     ^{fvInput durationView} minutes #
   <div .form-group>
     \ 
-    ^{fvInput recurranceView} #
+    ^{fvInput recurrenceView} #
   \ 
   starting at ^{fvInput timeView} #
   $if new