Skip to content

Commit

Permalink
Fix --all-before off by one session error
Browse files Browse the repository at this point in the history
  • Loading branch information
tasket committed Jun 22, 2023
1 parent 2441078 commit 75aea90
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions wyng
Original file line number Diff line number Diff line change
Expand Up @@ -1902,6 +1902,7 @@ def prune_sessions(datavol, times):
t1, t2 = "", "" ; to_prune = []

if len(sessions) < 2: print(" No extra sessions to prune.") ; return
if options.allbefore and len(times) != 1: x_it(1, "Option --all-before requires one session.")

# Validate date-time params
for pos, dt in enumerate(times[:]):
Expand Down Expand Up @@ -1946,10 +1947,10 @@ def prune_sessions(datavol, times):
for ses in sessions:
if ses > t1: start = sessions.index(ses) ; break
if t2 in sessions:
end = sessions.index(t2)+1
end = sessions.index(t2) + int(not options.allbefore)
else:
for ses in reversed(sessions):
if ses < t2: end = sessions.index(ses)+1 ; break
if ses < t2: end = sessions.index(ses) + 1 ; break
to_prune = sessions[start:end]

if len(to_prune) and to_prune[-1] == sessions[-1]:
Expand Down Expand Up @@ -2790,7 +2791,7 @@ def cleanup():

# Constants / Globals
prog_name = "wyng"
prog_version = "0.3.13" ; prog_date = "20230608"
prog_version = "0.3.14" ; prog_date = "20230622"
format_version = 2 ; debug = False ; tmpdir = None


Expand Down

0 comments on commit 75aea90

Please sign in to comment.