New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

igor: show - sort by owner #1160

Merged
merged 3 commits into from Aug 27, 2018

Conversation

Projects
None yet
2 participants
@csymonds
Contributor

csymonds commented Aug 13, 2018

Adding an option to the show command to allow sorting by owner name to make it easier to find reservations by owner

igor: Adding an option to the show command to allow sorting by owner …
…name to make it easier to find your own reservations

@csymonds csymonds requested a review from jcrussell Aug 13, 2018

@@ -151,7 +174,11 @@ func runShow(_ *Command, _ []string) {
}
// nameFmt will create uniform color bars for 1st column
nameFmt := "%" + strconv.Itoa(maxResNameLength) + "v"
sort.Sort(StartSorter(resarray))
if subO {
sort.Sort(ByOwner(resarray))

This comment has been minimized.

@jcrussell
@jcrussell

This comment has been minimized.

Contributor

jcrussell commented Aug 22, 2018

Looks good. Do we want to sort each owner's reservations by start time?

		sort.Slice(resarray, func(i, j int) bool {
			if resarray[i].Owner == resarray[j].Owner {
				return resarray[i].StartTime < resarray[j].StartTime
			}
			return resarray[i].Owner < resarray[j].Owner
		})

@csymonds csymonds merged commit 21a7944 into sandia-minimega:master Aug 27, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment