last session view: correct ordering from new to old

This commit is contained in:
Martin Bauer 2023-10-28 14:01:42 +02:00
parent a576e91290
commit 05681b2a5a
1 changed files with 2 additions and 5 deletions

View File

@ -181,7 +181,7 @@ async function getFullData(swimTrackerHost, analysisSettings) {
e.analysis = da.analyze(analysisSettings, e.startTime, e.values); e.analysis = da.analyze(analysisSettings, e.startTime, e.values);
} }
console.log("full data", parsed); console.log("full data", parsed);
return parsed; return parsed.reverse();
} }
// --------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------
@ -206,9 +206,6 @@ class LastSessionsView extends React.Component {
request({ url: "http://" + this.props.swimTrackerHost + "/webdav/" + sessionFileName, method: "DELETE" }) request({ url: "http://" + this.props.swimTrackerHost + "/webdav/" + sessionFileName, method: "DELETE" })
.then((value) => console.log("Successfully deleted", sessionFileName, value)) .then((value) => console.log("Successfully deleted", sessionFileName, value))
.catch((err) => console.error("Failed to delete", sessionFileName, err)); .catch((err) => console.error("Failed to delete", sessionFileName, err));
//this.setState({ sessions: null });
//await request({ url: "http://" + this.props.swimTrackerHost + "/webdav/" + sessionFileName, method: "DELETE" });
//this.setState({ sessions: await getFullData(this.props.swimTrackerHost, this.props.analysisSettings) });
}; };
const onRefresh = async () => { const onRefresh = async () => {
@ -224,7 +221,7 @@ class LastSessionsView extends React.Component {
style={{ width: "100%" }} style={{ width: "100%" }}
keyExtractor={item => item.startTime.toString()} keyExtractor={item => item.startTime.toString()}
disableRightSwipe={true} disableRightSwipe={true}
data={this.state.sessions.reverse()} data={this.state.sessions}
renderItem={(data, rowMap) => ( renderItem={(data, rowMap) => (
<SessionCard <SessionCard
textFirstLine={timeSince(data.item.startTime)} textFirstLine={timeSince(data.item.startTime)}