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

Add location to F2F payment option (backend) #867

Merged
merged 7 commits into from
Oct 10, 2023

Conversation

KoalaSat
Copy link
Member

@KoalaSat KoalaSat commented Sep 30, 2023

What does this PR do?

Backend work for #760

This PR introduces the new latitude and longitude attributes for an Order so users can assign a geographical coordinate for F2F payments.

This only includes the back-end changes.

Checklist before merging

  • Install pre-commit and initialize it: pip install pre-commit, then pre-commit install. Pre-commit installs git hooks that automatically check the codebase. If pre-commit fails when you commit your changes, please fix the problems it points out.

@KoalaSat KoalaSat changed the title Add location to F2F payment option Add location to F2F payment option [Backend] Sep 30, 2023
@KoalaSat KoalaSat changed the title Add location to F2F payment option [Backend] Add location to F2F payment option (backend) Sep 30, 2023
@KoalaSat KoalaSat marked this pull request as ready for review October 1, 2023 08:59
django.core.validators.MaxValueValidator(15.0),
],
),
),
Copy link
Member Author

@KoalaSat KoalaSat Oct 3, 2023

Choose a reason for hiding this comment

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

bond_size was generated together with makemigrations, not sure if it was just missing or a mistake on my side

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is not a mistake, but it is an undesired change. It is best to delete lines L39 to L51 before merging (that is migrations.AlterField(...) . Alternatively, you can also delete the migration file, edit .env to MIN_BOND_SIZE = 2 (instead of current value of 1) and the run manage.py makemigrations again. Should yield the same migration without altering the field bond_size.

The reason why this happened is that /api/models/order.py Order field bond_size depends on two config parameters that are read from the .env file. In my setup the .env file defines the MIN_BOND_SIZE as 2%, while the .env-sample defines it as 1% (at some point, there was a deviation, I changed my own .env without updating the .env-sample...). This migration will therefore allow bond sizes to be smaller than the current minimum of 2%.

I have opened a new issue (#873) so we make sure backend models are not dependant on any coordinator specific setting (.env) and therefore, we do not have any sort of conflict at run time when coordinators change values on their .env file.

docker-compose.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@Reckless-Satoshi Reckless-Satoshi left a comment

Choose a reason for hiding this comment

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

Hey @KoalaSat the PR looks good to go for me! It is best to delete the bond_size alter.

I left a comment with a deeper explanation of what has gone wrong and opened an issue so we do not have this problem during future development again.

django.core.validators.MaxValueValidator(15.0),
],
),
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is not a mistake, but it is an undesired change. It is best to delete lines L39 to L51 before merging (that is migrations.AlterField(...) . Alternatively, you can also delete the migration file, edit .env to MIN_BOND_SIZE = 2 (instead of current value of 1) and the run manage.py makemigrations again. Should yield the same migration without altering the field bond_size.

The reason why this happened is that /api/models/order.py Order field bond_size depends on two config parameters that are read from the .env file. In my setup the .env file defines the MIN_BOND_SIZE as 2%, while the .env-sample defines it as 1% (at some point, there was a deviation, I changed my own .env without updating the .env-sample...). This migration will therefore allow bond sizes to be smaller than the current minimum of 2%.

I have opened a new issue (#873) so we make sure backend models are not dependant on any coordinator specific setting (.env) and therefore, we do not have any sort of conflict at run time when coordinators change values on their .env file.

@Reckless-Satoshi
Copy link
Collaborator

This PR is ready for merge!

This PR is part of the "face-to-face" feature that has a development reward, I think it's probably best to payout the reward fully once the frontend work PR is ready. Talking about this reward, it now looks too small for the amount of work needed to get it done nicely following the current plan, so I propose doubling the reward to 2M Sats.

@Reckless-Satoshi Reckless-Satoshi merged commit 4d45b88 into RoboSats:main Oct 10, 2023
3 checks passed
KoalaSat added a commit to KoalaSat/robosats that referenced this pull request Oct 12, 2023
* Add location to F2F payment option

* Fix py linterns

* Include migration

* Revert docker-compose changes

* Remove bond_size from migration

* Rename 0043_order_latitude_order_longitude_alter_order_bond_size.py to 0043_order_latitude_order_longitude.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants