Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Donations to a milestone should be visible in campaign donations #67

Closed
2 tasks
vojtechsimetka opened this issue Oct 12, 2017 · 17 comments
Closed
2 tasks
Labels
funded good first issue Easy issue for new contributors help wanted Issues that are clear and can be picked by contributors.

Comments

@vojtechsimetka
Copy link
Collaborator

vojtechsimetka commented Oct 12, 2017

Donations made to a Milestone should be displayed under the Campaign in which the Milestone is created.

Implementation:
There are several options how to achieve this behavior. We prefer solution that does not add more API calls on the frontend. Suggested implementation would be:

Work time estimate:
1h

@vojtechsimetka vojtechsimetka added after bridge Issues to be tackled after the bridge mainnet-sidechain is build feedback for redesign Feedback and suggestions to be taken into account for redesign and are not issues to be tackled now. and removed enhancement after bridge Issues to be tackled after the bridge mainnet-sidechain is build labels Apr 14, 2018
@vojtechsimetka vojtechsimetka added this to the Redesign milestone Apr 15, 2018
@vojtechsimetka vojtechsimetka added help wanted Issues that are clear and can be picked by contributors. good first issue Easy issue for new contributors funding requested and removed feedback for redesign Feedback and suggestions to be taken into account for redesign and are not issues to be tackled now. labels Oct 4, 2018
@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 50.0 DAI (50.0 USD @ $1.0/DAI) attached to it as part of the Ethereum Community Fund via ECF Web 3.0 Infrastructure Fund fund__.__

@gitcoinbot
Copy link

gitcoinbot commented Oct 9, 2018

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 7 months from now.
Please review their action plans below:

1) cryptomental has been approved to start work.

Hi. I would like to follow the suggested implementation path: modify the feathers donation service and make frontend to use campaignId for milestones. I will likely open a PR today EOD.

Learn more on the Gitcoin Issue Details page.

cryptomental added a commit to cryptomental/giveth-dapp that referenced this issue Oct 10, 2018
A milestone is active if in progress and has *not* been fully funded yet.

Refs: Giveth#492,
      Giveth#67
@cryptomental
Copy link
Contributor

I just cannot believe it ;)

#497

took me lots of time for the setup though.

Fixes also #492 .

Screenshots:

screenshot from 2018-10-11 01 05 09
screenshot from 2018-10-11 01 05 55
screenshot from 2018-10-11 01 06 38
screenshot from 2018-10-11 01 06 48

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 50.0 DAI (50.0 USD @ $1.0/DAI) has been submitted by:

  1. @cryptomental

@mkosowsk please take a look at the submitted work:


@mkosowsk
Copy link

@vojtechsimetka does this PR from @cryptomental fulfill the requirements for the bounty? Thanks!

@vojtechsimetka
Copy link
Collaborator Author

vojtechsimetka commented Oct 11, 2018

@mkosowsk oh sorry I did not notice he applied with that PR to this bounty. No it does not solve the issue. It only enables donations to milestone, but does not display them in the Campaign. What we are asking for is displaying the donation in red under the campaign donations.

screen shot 2018-10-11 at 20 10 07

To offset the unexpected issues, I have added another 50 USD from my side. Appologies @cryptomental

@gitcoinbot
Copy link

💰 A crowdfund contribution worth 0.25000 ETH (50.78 USD @ $203.11/ETH) has been attached to this funded issue from @.💰

Want to chip in also? Add your own contribution here.

@cryptomental
Copy link
Contributor

Ok, thank you a lot for clarifying this. I was a bit confused. I will implement it the way it is desired.

cryptomental added a commit to cryptomental/giveth-dapp that referenced this issue Oct 13, 2018
…donations.

Subscribe to all campaign donations, including milestone donations.
Update CampaignService to subscribe more than one ownerTypeId from feathers.

Fixes: Giveth#67
@cryptomental
Copy link
Contributor

cryptomental commented Oct 13, 2018

Hi @vojtechsimetka @mkosowsk I implemented it as requested and opened a PR #502:

The implementation is based on the analysis of MongoDB donations entries for campaign and milestone that I entered locally:

CAMPAIGN
> db.donations.find({ownerTypeId:"5bbe76c21433b14a49c55079"})
{ "_id" : ObjectId("5bbe781e1433b14a49c55082"), "status" : "Committed", "mined" : true, "parentDonations" : [ "5bbe78351433b14a49c55085" ], "isReturn" : false, "giverAddress" : "0xd03ea8624C8C5987235048901fB614fDcA89b117", "amount" : "100000000000000000", "amountRemaining" : "100000000000000000", "pledgeId" : "2", "homeTxHash" : "0x7dbf6fb8537ab2a2e88f9a9b56d07bd771bbb603fc5ff9d6d785dbe6fb07e057", "ownerType" : "campaign", "ownerTypeId" : "5bbe76c21433b14a49c55079", "ownerId" : NumberLong(2), "createdAt" : ISODate("2018-10-10T22:07:26.135Z"), "updatedAt" : ISODate("2018-10-10T22:07:49.823Z"), "__v" : 0, "txHash" : "0x292887b4b70b064f6556ebe84d9981b617b14b0c8f12e41dc0ad7ff3d4acaa30", "commitTime" : ISODate("2018-10-10T22:07:38Z") }
{ "_id" : ObjectId("5bbe788d1433b14a49c55086"), "status" : "Committed", "mined" : true, "parentDonations" : [ "5bbe78aa1433b14a49c55089" ], "isReturn" : false, "giverAddress" : "0xd03ea8624C8C5987235048901fB614fDcA89b117", "amount" : "150000000000000000", "amountRemaining" : "150000000000000000", "pledgeId" : "2", "homeTxHash" : "0x8c7ed8f35d1b438e580ea5549a75fcee3559e4b26ed8bef13a5fc86da32d38b2", "ownerType" : "campaign", "ownerTypeId" : "5bbe76c21433b14a49c55079", "ownerId" : NumberLong(2), "createdAt" : ISODate("2018-10-10T22:09:17.971Z"), "updatedAt" : ISODate("2018-10-10T22:09:46.597Z"), "__v" : 0, "txHash" : "0x23e2dce84c8601137400ab151ecd5884d40adb19a0d1f89558a4737e1127cf15", "commitTime" : ISODate("2018-10-10T22:09:36Z") }

MILESTONE 1 
> db.donations.find({ownerTypeId:"5bbe77261433b14a49c5507c"})
{ "_id" : ObjectId("5bbe80721433b14a49c5508a"), "status" : "Committed", "mined" : true, "parentDonations" : [ "5bbe80881433b14a49c5508d" ], "isReturn" : false, "giverAddress" : "0xd03ea8624C8C5987235048901fB614fDcA89b117", "amount" : "500000000000000000", "amountRemaining" : "500000000000000000", "pledgeId" : "3", "homeTxHash" : "0x7190be22ddc802edd1410765bb931e21f70e20a180c443eaf6e4fbecca0dc012", "ownerType" : "milestone", "ownerTypeId" : "5bbe77261433b14a49c5507c", "ownerId" : NumberLong(3), "createdAt" : ISODate("2018-10-10T22:42:58.497Z"), "updatedAt" : ISODate("2018-10-10T22:43:21.217Z"), "__v" : 0, "txHash" : "0xb846b652303194cafadde60f2291cb7783bd21ee2bbc11584dd65847a5eb1f8d", "commitTime" : ISODate("2018-10-10T22:43:10Z") }
{ "_id" : ObjectId("5bbe81d91433b14a49c5508e"), "status" : "Committed", "mined" : true, "parentDonations" : [ "5bbe81fd1433b14a49c55091" ], "isReturn" : false, "giverAddress" : "0xd03ea8624C8C5987235048901fB614fDcA89b117", "amount" : "250000000000000000", "amountRemaining" : "250000000000000000", "pledgeId" : "3", "homeTxHash" : "0xd39da8a5966055c850ffbb858a4dd640e33cf127a73aba50e103daa7310397a4", "ownerType" : "milestone", "ownerTypeId" : "5bbe77261433b14a49c5507c", "ownerId" : NumberLong(3), "createdAt" : ISODate("2018-10-10T22:48:57.448Z"), "updatedAt" : ISODate("2018-10-10T22:49:33.508Z"), "__v" : 0, "txHash" : "0x459f1686dd4e46672265bb490a03d06390cd9aa892c9ab6abc49577b4647d46d", "commitTime" : ISODate("2018-10-10T22:49:22Z") }
{ "_id" : ObjectId("5bbe82241433b14a49c55092"), "status" : "Committed", "mined" : true, "parentDonations" : [ "5bbe823a1433b14a49c55095" ], "isReturn" : false, "giverAddress" : "0xd03ea8624C8C5987235048901fB614fDcA89b117", "amount" : "250000000000000000", "amountRemaining" : "250000000000000000", "pledgeId" : "3", "homeTxHash" : "0x09727d43533c0e7cf5df7f9e4ab43d41037ad05022f3458831c13c2cbdb0aebb", "ownerType" : "milestone", "ownerTypeId" : "5bbe77261433b14a49c5507c", "ownerId" : NumberLong(3), "createdAt" : ISODate("2018-10-10T22:50:12.703Z"), "updatedAt" : ISODate("2018-10-10T22:50:34.981Z"), "__v" : 0, "txHash" : "0x9763a5dc7eded3bc971a6d1a5b4f493d38be695148263e5ab54b2c1a3ef26f81", "commitTime" : ISODate("2018-10-10T22:50:24Z") }

MILESTONE 2
> db.donations.find({ownerTypeId:"5bbe77561433b14a49c5507f"})
{ "_id" : ObjectId("5bbe82631433b14a49c55096"), "status" : "Committed", "mined" : true, "parentDonations" : [ "5bbe82861433b14a49c55099" ], "isReturn" : false, "giverAddress" : "0xd03ea8624C8C5987235048901fB614fDcA89b117", "amount" : "300000000000000000", "amountRemaining" : "300000000000000000", "pledgeId" : "4", "homeTxHash" : "0x0456272bdb7529652cff9f6eb2a6e9450feeac8ae7ccff8e894870f84e959282", "ownerType" : "milestone", "ownerTypeId" : "5bbe77561433b14a49c5507f", "ownerId" : NumberLong(4), "createdAt" : ISODate("2018-10-10T22:51:15.135Z"), "updatedAt" : ISODate("2018-10-10T22:51:50.753Z"), "__v" : 0, "txHash" : "0xa7fadca86c486d9119f1885b479d8c8f1d8bc31314631a2a3cda01e0bf90eab3", "commitTime" : ISODate("2018-10-10T22:51:39Z") }
{ "_id" : ObjectId("5bbe839f1433b14a49c5509a"), "status" : "Committed", "mined" : true, "parentDonations" : [ "5bbe83be1433b14a49c5509d" ], "isReturn" : false, "giverAddress" : "0xd03ea8624C8C5987235048901fB614fDcA89b117", "amount" : "200000000000000000", "amountRemaining" : "200000000000000000", "pledgeId" : "4", "homeTxHash" : "0x1aa5cf111c490b2f87218cb8be570d3c7fdaf14e26513bba4cd62deb7d6c044c", "ownerType" : "milestone", "ownerTypeId" : "5bbe77561433b14a49c5507f", "ownerId" : NumberLong(4), "createdAt" : ISODate("2018-10-10T22:56:31.745Z"), "updatedAt" : ISODate("2018-10-10T22:57:02.830Z"), "__v" : 0, "txHash" : "0xfc1b1dcf50e29b31864724e80405b505727c3c31791a72c6efd07617a83e35b6", "commitTime" : ISODate("2018-10-10T22:56:52Z") }

I understood that no changes in the db schema are needed and ownerTypeId can still be used, just donations subscription in CampaignService needs to be extended. Therefore the new approach is to lazy load donations using subscriber that can handle both campaignId and milestonesIds for the campaign.

The donations are properly shown now:

screenshot from 2018-10-13 12 46 38
screenshot from 2018-10-13 12 46 53

@vojtechsimetka
Copy link
Collaborator Author

Hi @cryptomental . Thank you for the PR and analysis. I agree that this works, but it is not 100% because if there is a lot of milestones, not all of them will be loaded. I know that right now this may not be an issue, because such milestones will be old and unlikely to be donated to recently and the current donation view would not suffer from it. The role of the database here is different - it is supposed to cache all the data stored in blockchain and IPFS and redundancy is OK (yeah it feels wrong). It's supposed to be fast to cache and fast to query. In future we may replace it with a better suited database like postgre that will allow us to do relational and location queries. Then, of course, redundancy would be counterproductive.

vojtechsimetka pushed a commit that referenced this issue Oct 13, 2018
A milestone is active if in progress and has *not* been fully funded yet.

Refs: #492,
      #67
@cryptomental
Copy link
Contributor

Ok. I see. I will rework this then as initially suggested.

cryptomental added a commit to cryptomental/giveth-dapp that referenced this issue Oct 14, 2018
Add campaignId for Milestone and Campaign donations. Extend DonateButton
model to optionally store campaignId and DonationService to store campaignId
into feathers.

Dependencies: feathers-giveth Donation model needs to be extended with
an optional campaignId field.

Fixes: Giveth#67
cryptomental added a commit to cryptomental/feathers-giveth that referenced this issue Oct 14, 2018
The campaignId can be optionally use to store campaign id when
a donation is made for campaign or a milestone. Then all donations
for a campaign, including milestone donations can be queried
using campaigId field.

Refs: Giveth/giveth-dapp#67
@cryptomental
Copy link
Contributor

Hi @vojtechsimetka I opened two new pull requests:

#506
Giveth/feathers-giveth#100

to be able to use campaignId as previously mentioned. Donation service is now able to store campaignId when needed and feathers-giveth had to have Donations model extended with an optional field pointing to campaignId. I would be grateful if you had a look again now.

cryptomental added a commit to cryptomental/giveth-dapp that referenced this issue Oct 14, 2018
Add campaignId for Milestone and Campaign donations. Extend DonateButton
model to optionally store campaignId and DonationService to store campaignId
into feathers.

Dependencies: feathers-giveth Donation model needs to be extended with
an optional campaignId field.

Fixes: Giveth#67
@vojtechsimetka
Copy link
Collaborator Author

Thank you @cryptomental I will review this in the morning. It looks fine, I would like for the campaignId to be deduced on feathers rather than being pushed from the frontend, but that is small thing and I can quickly modify.

cryptomental added a commit to cryptomental/giveth-dapp that referenced this issue Oct 15, 2018
Add campaignId for Milestone and Campaign donations. Extend DonateButton
model to optionally store campaignId and DonationService to store campaignId
into feathers.

Dependencies: feathers-giveth Donation model needs to be extended with
an optional campaignId field.

Fixes: Giveth#67
@cryptomental
Copy link
Contributor

Ok great! I rebased the pull request today morning against latest develop branch. Please modify as you expect.

@vojtechsimetka
Copy link
Collaborator Author

Thank you @cryptomental !

@mkosowsk this bounty can be paid out

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 50.0 DAI (50.0 USD @ $1.0/DAI) (plus a crowdfund of 0.25 ETH worth 54.4532026525 USD) attached to this issue has been approved & issued to @cryptomental.

@cryptomental
Copy link
Contributor

Great. Thank you!

vojtechsimetka pushed a commit to Giveth/feathers-giveth that referenced this issue Oct 26, 2018
The campaignId can be optionally use to store campaign id when
a donation is made for campaign or a milestone. Then all donations
for a campaign, including milestone donations can be queried
using campaigId field.

Refs: Giveth/giveth-dapp#67
vojtechsimetka pushed a commit that referenced this issue Oct 26, 2018
Add campaignId for Milestone and Campaign donations. Extend DonateButton
model to optionally store campaignId and DonationService to store campaignId
into feathers.

Dependencies: feathers-giveth Donation model needs to be extended with
an optional campaignId field.

Fixes: #67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
funded good first issue Easy issue for new contributors help wanted Issues that are clear and can be picked by contributors.
Projects
None yet
Development

No branches or pull requests

4 participants