|
|
|
@ -41,14 +41,11 @@ impl Timeline { |
|
|
|
|
fn last_session(&mut self) -> Option<&mut Session> { |
|
|
|
|
self.inner |
|
|
|
|
.iter_mut() |
|
|
|
|
.find(|e| match e { |
|
|
|
|
Entry::Session(_) => true, |
|
|
|
|
_ => false, |
|
|
|
|
}) |
|
|
|
|
.map(|e| match e { |
|
|
|
|
Entry::Session(ref mut s) => s, |
|
|
|
|
_ => unreachable!(), |
|
|
|
|
.filter_map(|e| match e { |
|
|
|
|
Entry::Session(s) => Some(s), |
|
|
|
|
_ => None, |
|
|
|
|
}) |
|
|
|
|
.last() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Utility function to get the last invoice in the timeline
|
|
|
|
|