summaryrefslogtreecommitdiff
path: root/Logs
diff options
context:
space:
mode:
Diffstat (limited to 'Logs')
-rw-r--r--Logs/Transfer.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/Logs/Transfer.hs b/Logs/Transfer.hs
index 642ee7ea1..ea56035d1 100644
--- a/Logs/Transfer.hs
+++ b/Logs/Transfer.hs
@@ -60,6 +60,13 @@ readLcDirection "upload" = Just Upload
readLcDirection "download" = Just Download
readLcDirection _ = Nothing
+{- Transfers that will accomplish the same task. -}
+equivilantTransfer :: Transfer -> Transfer -> Bool
+equivilantTransfer t1 t2
+ | transferDirection t1 == Download && transferDirection t2 == Download &&
+ transferUUID t1 == transferUUID t2 = True
+ | otherwise = t1 == t2
+
percentComplete :: Transfer -> TransferInfo -> Maybe Percentage
percentComplete (Transfer { transferKey = key }) info =
percentage <$> keySize key <*> Just (fromMaybe 0 $ bytesComplete info)