From 7c4805d3ea2e2274640b80af6fb761ac9f620197 Mon Sep 17 00:00:00 2001 From: Dmitry A Date: Mon, 14 Oct 2019 20:01:10 +0300 Subject: [PATCH 1/2] clone editing object; shorten button text. do not alert when tour is not loading --- TourCalcWebApp/App/containers/appstate.jsx | 2 +- TourCalcWebApp/App/containers/tour-person-edit.jsx | 2 +- TourCalcWebApp/App/containers/tour-spending-edit.jsx | 2 +- TourCalcWebApp/App/containers/tour-ui.jsx | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/TourCalcWebApp/App/containers/appstate.jsx b/TourCalcWebApp/App/containers/appstate.jsx index fec81377..7fbd2047 100644 --- a/TourCalcWebApp/App/containers/appstate.jsx +++ b/TourCalcWebApp/App/containers/appstate.jsx @@ -169,7 +169,7 @@ export default class AppState { comp.setState(this.state); }, (error) => { - alert('Error loading tour') + //alert('Error loading tour') this.state = { isTourLoaded: true, error diff --git a/TourCalcWebApp/App/containers/tour-person-edit.jsx b/TourCalcWebApp/App/containers/tour-person-edit.jsx index 50315270..63effc48 100644 --- a/TourCalcWebApp/App/containers/tour-person-edit.jsx +++ b/TourCalcWebApp/App/containers/tour-person-edit.jsx @@ -27,7 +27,7 @@ export default class PersonForm extends React.Component { super(props); this.state = { dialogOpen: props.open, - person: props.person == null ? { name: "", weight: 100, parentId: "" } : props.person, + person: props.person == null ? { name: "", weight: 100, parentId: "" } : JSON.parse(JSON.stringify(props.person)), tour: props.tour } } diff --git a/TourCalcWebApp/App/containers/tour-spending-edit.jsx b/TourCalcWebApp/App/containers/tour-spending-edit.jsx index ecdafd3a..54e84617 100644 --- a/TourCalcWebApp/App/containers/tour-spending-edit.jsx +++ b/TourCalcWebApp/App/containers/tour-spending-edit.jsx @@ -37,7 +37,7 @@ export default class SpendingsForm extends React.Component { constructor(props) { super(props); this.tour = props.tour - if (props.spending != null) this.spending = props.spending + if (props.spending != null) this.spending = JSON.parse(JSON.stringify(props.spending)) else this.spending.fromGuid = this.tour.persons.length > 0 ? this.tour.persons[0].guid : "" this.state = { dialogOpen: props.open, diff --git a/TourCalcWebApp/App/containers/tour-ui.jsx b/TourCalcWebApp/App/containers/tour-ui.jsx index ad05d854..0cfb91ed 100644 --- a/TourCalcWebApp/App/containers/tour-ui.jsx +++ b/TourCalcWebApp/App/containers/tour-ui.jsx @@ -150,8 +150,9 @@ class TourTable extends React.Component { app={this} >   - From 0e1558c1280787f4b8eba5d3640bc74473051ab6 Mon Sep 17 00:00:00 2001 From: Dmitry A Date: Mon, 14 Oct 2019 21:00:11 +0300 Subject: [PATCH 2/2] name of suggested payment --- TCalcCore/Logic/TourCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TCalcCore/Logic/TourCalculator.cs b/TCalcCore/Logic/TourCalculator.cs index 007407bb..24408a07 100644 --- a/TCalcCore/Logic/TourCalculator.cs +++ b/TCalcCore/Logic/TourCalculator.cs @@ -195,7 +195,7 @@ public Tour SuggestFinalPayments() ToGuid = new[] { creditors.First().GUID }.ToList(), ToAll = false, AmountInCents = credit > highestDebt ? highestDebt : credit, - Description = $"'{debtors.First()?.Name ?? "n/a"}' -> '{creditors.First()?.Name ?? "n/a"}'", + Description = $"X '{debtors.First()?.Name ?? "n/a"}' -> '{creditors.First()?.Name ?? "n/a"}'", GUID = Guid.NewGuid().ToString() }); // add spending