Skip to content

Commit

Permalink
Clamp index in case all examples are active
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeAtHPI committed Jul 4, 2023
1 parent 6bf0b7f commit cb22938
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
accessing
menuSelectionItems

| examples |
| examples firstInactiveIndex |
examples := (BPExamples value examples asSortedCollection: [:a :b |
a isActive asNumber > b isActive asNumber ]) asOrderedCollection.
examples add: #- beforeIndex: (examples findFirst: [:anExample | anExample isActive not]).
firstInactiveIndex := examples findFirst: [:anExample | anExample isActive not].
(firstInactiveIndex == 0) ifTrue: [firstInactiveIndex := 1].
examples add: #- beforeIndex: firstInactiveIndex.

^ {BPNilExample new}, examples
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"menuSelectionItems" : "joabe 7/4/2023 16:23",
"menuSelectionItems" : "joabe 7/4/2023 16:48",
"newForExample:context:" : "joabe 5/9/2023 17:38" },
"instance" : {
"addSwimlane" : "jb 1/31/2022 22:35",
Expand Down

0 comments on commit cb22938

Please sign in to comment.