don't show "unknown" as the percent complete for transferinfo with no bytesComplete value

This commit is contained in:
Joey Hess 2012-08-28 14:31:30 -04:00
parent 1296cfb09a
commit 19e8f1ca0e

View file

@ -61,9 +61,8 @@ readLcDirection "download" = Just Download
readLcDirection _ = Nothing
percentComplete :: Transfer -> TransferInfo -> Maybe Percentage
percentComplete (Transfer { transferKey = key }) (TransferInfo { bytesComplete = Just complete }) =
(\size -> percentage size complete) <$> keySize key
percentComplete _ _ = Nothing
percentComplete (Transfer { transferKey = key }) info =
percentage <$> keySize key <*> Just (fromMaybe 0 $ bytesComplete info)
upload :: UUID -> Key -> AssociatedFile -> Annex Bool -> Annex Bool
upload u key file a = runTransfer (Transfer Upload u key) file a