Skip to content

Commit

Permalink
Add ficsit guarantee™ for ETAs
Browse files Browse the repository at this point in the history
  • Loading branch information
mircearoata committed Dec 29, 2023
1 parent 7001f5f commit 81a0fc9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions backend/bindings/ficsitcli/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,28 +86,38 @@ func (f *FicsitCLI) validateInstall(installation *InstallationInfo, progressItem

if hasDownloading {
if downloadBytesProgress.Total != 0 {
eta := downloadProgressTracker.ETA().Round(time.Second)
etaText := eta.String()
if eta == 0 {
etaText = "soon™"
}
f.setProgress(&Progress{
Item: progressItem,
Message: fmt.Sprintf(
"Downloading %d/%d mods: %s/%s, %s/s, %s",
downloadModsProgress.Completed, downloadModsProgress.Total,
humanize.Bytes(uint64(downloadBytesProgress.Completed)), humanize.Bytes(uint64(downloadBytesProgress.Total)),
humanize.Bytes(uint64(downloadProgressTracker.Speed())),
downloadProgressTracker.ETA().Round(time.Second),
etaText,
),
Progress: downloadBytesProgress.Percentage(),
})
}
} else {
if extractBytesProgress.Total != 0 {
eta := extractProgressTracker.ETA().Round(time.Second)
etaText := eta.String()
if eta == 0 {
etaText = "soon™"
}
f.setProgress(&Progress{
Item: progressItem,
Message: fmt.Sprintf(
"Extracting %d/%d mods: %s/%s, %s/s, %s",
extractModsProgress.Completed, extractModsProgress.Total,
humanize.Bytes(uint64(extractBytesProgress.Completed)), humanize.Bytes(uint64(extractBytesProgress.Total)),
humanize.Bytes(uint64(extractProgressTracker.Speed())),
extractProgressTracker.ETA().Round(time.Second),
etaText,
),
Progress: extractBytesProgress.Percentage(),
})
Expand Down

0 comments on commit 81a0fc9

Please sign in to comment.