Job ProgressBar logic is bogus

here we have: 

progress
        ^ (currentValue - min) / (max - min)

raises ZeroDivide.

and progress is invoked by basicProgress:

basicProgress: aNormalizedFloat
        "Set the progress: 0.0 - 1.0 without triggering an update"
        currentValue := (min + ((max - min) * aNormalizedFloat))

In my case I have currentValue, min and max = 1 

does anybody know this code?
and how we can fix it.

How to reproduce the problem
        MCStReaderTest debug: #testCommentWithStyle



Here we have

fileInFrom: aStream
        | changes |
        changes := ChangeSet scanFile: aStream from: 0 to: aStream size.
        aStream close.
        ('Processing ', self packageName) 
                displayProgressFrom: 1
                                                ^^^^^
                                                which set the min to 1. Setting 
it to 0 can solve the problem but the progress bar should be more robust        
                to: changes size
                        ^^^^^^^^^^
                        max to 1                
                during:[:bar| | chgRec |
                        1 to: changes size do:[:i|
                                bar current: i.
                                chgRec := changes at: i.
                                self perform: (chgRec type copyWith: $:) 
asSymbol
with: chgRec.
                        ].
                ].


Stef

Reply via email to