Browse Source

fix so that contact recipient is also recorded

fix-contact-totals
Trent Larson 1 year ago
parent
commit
0444b5be32
  1. 2
      project.task.yaml
  2. 35
      src/views/ContactsView.vue

2
project.task.yaml

@ -1,5 +1,6 @@
tasks:
- .2 bug - on contacts view, click on "to" & "from" and nothing happens
- 01 add a location for a project via map pin
- 04 search by a bounding box for local projects (see API by clicking on "Nearby")
- 01 Replace Gifted/Give in ContactsView with GiftedDialog assignee:jose
@ -32,6 +33,7 @@ tasks:
- .2 on ProjectViewView, show different messages for "to" and "from" sections if none exist
- .2 fix static icon to the right on project page (Matthew - I've made "Rotary" into issuer?)
- .2 fix rate limit verbiage (with the new one-per-day allowance) assignee:trent
- .2 move 'switch identity' to the advanced section
- Discuss whether the remaining tasks are worthwhile before MVP release.

35
src/views/ContactsView.vue

@ -66,6 +66,10 @@
: "Unconfirmed"
}}
</button>
<br />
(Only hours shown)
<br />
(Only recent shown)
</div>
</div>
@ -135,7 +139,10 @@
<fa icon="trash-can" class="fa-fw" />
</button>
<div v-if="!showGiveNumbers" class="ml-auto flex gap-1.5">
<div
v-if="showGiveNumbers && contact.did != activeDid"
class="ml-auto flex gap-1.5"
>
<button
class="text-sm uppercase bg-blue-600 text-white px-2 py-1.5 rounded-md"
@click="onClickAddGive(activeDid, contact.did)"
@ -294,20 +301,28 @@ export default class ContactsView extends Vue {
}
async loadGives() {
const handleResponse = (resp, descriptions, confirmed, unconfirmed) => {
const handleResponse = (
resp,
allData,
descriptions,
confirmed,
unconfirmed,
useRecipient,
) => {
if (resp.status === 200) {
const allData = resp.data.data;
for (const give of allData) {
const otherDid = useRecipient ? give.recipientDid : give.agentDid;
console.log("give from", otherDid, "is", give.amount, "HUR");
if (give.unit === "HUR") {
if (give.amountConfirmed) {
const prevAmount = confirmed[give.agentDid] || 0;
confirmed[give.agentDid] = prevAmount + give.amount;
const prevAmount = confirmed[otherDid] || 0;
confirmed[otherDid] = prevAmount + give.amount;
} else {
const prevAmount = unconfirmed[give.agentDid] || 0;
unconfirmed[give.agentDid] = prevAmount + give.amount;
const prevAmount = unconfirmed[otherDid] || 0;
unconfirmed[otherDid] = prevAmount + give.amount;
}
if (!descriptions[give.agentDid] && give.description) {
descriptions[give.agentDid] = give.description;
if (!descriptions[otherDid] && give.description) {
descriptions[otherDid] = give.description;
}
}
}
@ -352,6 +367,7 @@ export default class ContactsView extends Vue {
givenByMeDescriptions,
givenByMeConfirmed,
givenByMeUnconfirmed,
true,
);
this.givenByMeDescriptions = givenByMeDescriptions;
this.givenByMeConfirmed = givenByMeConfirmed;
@ -365,6 +381,7 @@ export default class ContactsView extends Vue {
givenToMeDescriptions,
givenToMeConfirmed,
givenToMeUnconfirmed,
false,
);
this.givenToMeDescriptions = givenToMeDescriptions;
this.givenToMeConfirmed = givenToMeConfirmed;

Loading…
Cancel
Save