Skip to content

Commit e93e0f4

Browse files
committed
Refactor initialization in EstimateExecute
Moved shared property assignments outside the switch statement in the EstimateExecute initializer to reduce code duplication and improve readability.
1 parent e4d27a9 commit e93e0f4

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

RsyncUI/Model/Execution/EstimateExecute/EstimateExecute.swift

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -185,34 +185,25 @@ final class EstimateExecute {
185185
updateconfigurations: @escaping ([SynchronizeConfiguration]) -> Void,
186186
mode: OperationMode)
187187
{
188+
189+
structprofile = profile
190+
localconfigurations = configurations
191+
localprogressdetails = progressdetails
192+
localfilehandler = filehandler
193+
localupdateconfigurations = updateconfigurations
188194

189195
switch mode {
190196

191197
case .execute:
192-
structprofile = profile
193-
localconfigurations = configurations
194-
localprogressdetails = progressdetails
195-
localfilehandler = filehandler
196-
localupdateconfigurations = updateconfigurations
197-
198198
guard selecteduuids.count > 0 else { return }
199-
200199
let taskstosynchronize = localconfigurations.filter {
201200
selecteduuids.contains($0.id) && $0.task != SharedReference.shared.halted
202201
}
203202
stackoftasks = taskstosynchronize.map(\.hiddenID)
204-
205203
guard stackoftasks?.count ?? 0 > 0 else { return }
206204
Logger.process.debugmessageonly("EstimateExecute: START EXECUTION")
207205
startexecution()
208-
209206
case .estimate:
210-
structprofile = profile
211-
localconfigurations = configurations
212-
localprogressdetails = progressdetails
213-
localfilehandler = filehandler
214-
localupdateconfigurations = updateconfigurations
215-
216207
stackoftasks = computestackoftasks(selecteduuids)
217208
localprogressdetails?.setprofileandnumberofconfigurations(structprofile, stackoftasks?.count ?? 0)
218209
Logger.process.debugmessageonly("EstimateExecute: START ESTIMATION")

0 commit comments

Comments
 (0)