Sort all entries after evaluation
This commit is contained in:
parent
3e70b2e2c9
commit
efa9b7de03
3 changed files with 19 additions and 12 deletions
|
|
@ -44,16 +44,11 @@ impl<'a> CommandState<'a> {
|
|||
Ok(self)
|
||||
}
|
||||
|
||||
pub fn entries(mut self) -> Vec<Entry> {
|
||||
let mut keys = self.dated.keys().copied().collect::<Vec<_>>();
|
||||
keys.sort();
|
||||
|
||||
let mut entries = self.undated;
|
||||
for key in keys {
|
||||
entries.push(self.dated.remove(&key).unwrap());
|
||||
}
|
||||
|
||||
entries
|
||||
pub fn entries(self) -> Vec<Entry> {
|
||||
self.undated
|
||||
.into_iter()
|
||||
.chain(self.dated.into_values())
|
||||
.collect()
|
||||
}
|
||||
|
||||
// Helper functions
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ impl Dates {
|
|||
self.times.map(|times| times.other)
|
||||
}
|
||||
|
||||
fn start_end(&self) -> (NaiveDate, NaiveDate) {
|
||||
pub fn start_end(&self) -> (NaiveDate, NaiveDate) {
|
||||
if self.root <= self.other {
|
||||
(self.root, self.other)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue