addScore :: UserScore -> RideDetails -> UserScore
addScore score ride
    | currentDay score /= utctDay (rideStart ride)
        = addDay $ addMileage $ score { currentDay = utctDay $ rideStart ride, currentMiles = 0 }
    | otherwise
        = (if (currentMiles score < 1) then addDay else id) $ addMileage $ score
    where
    addMileage :: UserScore -> UserScore
    addMileage s = s { 
        rides = rides s + 1, 
        miles = miles s + rideMiles ride, 
        currentMiles = currentMiles s + rideMiles ride,
        currentRide = if (rideID ride > currentRide s) then rideID ride else currentRide s }
    addDay :: UserScore -> UserScore
    addDay s = if (currentMiles s >= 1) then s { days = days s + 1 } else s
addScore :: UserScore -> RideDetails -> UserScore
addScore score ride
    | currentDay score /= utctDay (rideStart ride)
        = addDay $ addMileage $ score { currentDay = utctDay $ rideStart ride, currentMiles = 0 }
    | otherwise
        = (if (currentMiles score < 1) then addDay else id) $ addMileage $ score
    where
    addMileage :: UserScore -> UserScore
    addMileage s = s { 
        rides = rides s + 1, 
        miles = miles s + rideMiles ride, 
        currentMiles = currentMiles s + rideMiles ride,
        currentRide = if (rideID ride > currentRide s) then rideID ride else currentRide s }
    addDay :: UserScore -> UserScore
    addDay s = if (currentMiles s >= 1) then s { days = days s + 1 } else s
addScore score ride
    | currentDay score /= utctDay (rideStart ride)
        = addDay $ addMileage $ score { currentDay = utctDay $ rideStart ride, currentMiles = 0 }
    | otherwise
        = (if (currentMiles score < 1) then addDay else id) $ addMileage $ score
    where
    addMileage :: UserScore -> UserScore
    addMileage s = s { 
        rides = rides s + 1, 
        miles = miles s + rideMiles ride, 
        currentMiles = currentMiles s + rideMiles ride,
        currentRide = if (rideID ride > currentRide s) then rideID ride else currentRide s }
    addDay :: UserScore -> UserScore
    addDay s = if (currentMiles s >= 1) then s { days = days s + 1 } else s