Skip to content
This repository was archived by the owner on Jun 29, 2020. It is now read-only.

Refactor unregister address method #154

Merged
merged 6 commits into from
May 30, 2018
Merged

Conversation

fvictorio
Copy link
Contributor

@fvictorio fvictorio commented May 29, 2018

Closes #149.
Closes #155.

Note that this will do an unnecessary assignment when the user removes the last address, but I'm not sure if adding a conditional is worth it.

I also added more tests to be sure that it's working as expected.

@fvictorio fvictorio requested a review from phahulin May 29, 2018 22:17
@ghost ghost assigned fvictorio May 29, 2018
@ghost ghost added the in progress label May 29, 2018
@coveralls
Copy link

coveralls commented May 29, 2018

Pull Request Test Coverage Report for Build 478

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 79.423%

Totals Coverage Status
Change from base Build 470: 0.04%
Covered Lines: 961
Relevant Lines: 1185

💛 - Coveralls

@phahulin
Copy link
Contributor

I think we should add conditional for clarity.

@fvictorio
Copy link
Contributor Author

Done. I also fixed the issue with the coverage script.

@fvictorio fvictorio mentioned this pull request May 30, 2018
@@ -342,11 +342,9 @@ contract ProofOfPhysicalAddress {
// Remove physical address from list
uint256 length = users[msg.sender].physicalAddresses.length;

for (uint256 i = index; i < length - 1; i++) {
users[msg.sender].physicalAddresses[i] = users[msg.sender].physicalAddresses[i+1];
if (length > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be if (index != length -1) { ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that's much better. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@phahulin phahulin self-requested a review May 30, 2018 20:28
@phahulin phahulin merged commit ab268d9 into master May 30, 2018
@ghost ghost removed the in progress label May 30, 2018
@phahulin phahulin deleted the refactor-address-removal branch May 30, 2018 20:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants