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

Kudos v1 #2492

Merged
merged 699 commits into from
Oct 27, 2018
Merged

Kudos v1 #2492

merged 699 commits into from
Oct 27, 2018

Conversation

jasonrhaas
Copy link
Contributor

Description

Kudos!

Checklist
  • linter status: 100% pass
  • changes don't break existing behavior
  • commit message follows commit guidelines
Affected core subsystem(s)
  • ui
  • database
  • new blockchain contract
Testing

To run this locally you must have the solidity contract code locally on your machine. It should be at the same directory level as this repo. The repository is called gitcoin-erc721. After you have cloned that repo, follow these steps inside this repo:

  • git checkout kudos-v1
  • export TEST_MNEMONIC="Your test mnemonic"
  • docker-compose pull to pull in all the latest images
  • docker-compose build --force-rm to force a fresh build of the web docker container
  • ./fresh_start to remove old docker volumes, spin up fresh instances, deploy the kudos contract locally, and finally mint all the kudos. Kudos will be minted to the first account in the wallet. Contact the Gitcoin core team to get the test keys for Rinkeby.
  • Navigate to http://localhost:8000/kudos and be sure to use the "Private Network" setting in MetaMask.
Refers/Fixes

@@ -75,7 +76,12 @@ def insert_settings(request):
username__iexact=context['github_handle'],
web3_type='v3',
).exclude(txid='')
context['unclaimed_kudos'] = KudosTransfer.objects.filter(
receive_txid='', username__iexact="@" + context['github_handle'], web3_type='v3',
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we update this model to directly relate to Profile?

Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -25,7 +25,7 @@ window.onload = function() {
}
ipfs.catText(document.ipfs_key_to_secret, function(err, key2) {
if (err) {
_alert('could not reach IPFS. please try again later.', 'error');
_alert('Could not reach IPFS. please try again later.', 'error');
Copy link
Contributor

Choose a reason for hiding this comment

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

😅

app/assets/v2/css/kudos/select2.bootstrap4.scss Outdated Show resolved Hide resolved
@@ -0,0 +1,33 @@
/**
* Transform eth to usd
Copy link
Contributor

Choose a reason for hiding this comment

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

🙌


var rotate_kudos_msg = function() {
var messages = [
[ 'Buy Me!', 'I\'m looking for a good home.' ],
Copy link
Contributor

Choose a reason for hiding this comment

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

@octavioamu @jasonrhaas Does this apply to all of the copy? Like the alert text for cloning errors?

owner_address=to_checksum_address(context['preferred_payout_address']),
contract__network=settings.KUDOS_NETWORK
).order_by(order_by)
sent_kudos = Token.objects.filter(
Copy link
Contributor

Choose a reason for hiding this comment

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

We should select_related on the 'kudos_transfer', 'contract' since we're filtering on values from it here.

if context['preferred_payout_address']:
owned_kudos = Token.objects.filter(
owner_address=to_checksum_address(context['preferred_payout_address']),
contract__network=settings.KUDOS_NETWORK
Copy link
Contributor

Choose a reason for hiding this comment

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

We should select_related on the 'contract' since we're filtering on values from it here.

# Send kudos data when new preferred address
address = request.POST.get('address')
context['kudos'] = Token.objects.filter(owner_address=to_checksum_address(address)).order_by(order_by)
context['sent_kudos'] = Token.objects.filter(kudos_transfer__from_address=to_checksum_address(address)).order_by(order_by)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should select_related on the 'kudos_transfer' since we're filtering on values from it here.

datarequest = request.POST.get('request')
order_by = request.GET.get('order_by', '-modified_on')
# use Django’s pagination
# https://docs.djangoproject.com/en/dev/topics/pagination/
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we omit these comments? Also, should we use paginator.get_page(page) vs the manual handling of emptypage/integer/etc ?

Copy link
Contributor

Choose a reason for hiding this comment

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

We can evaluate, I don't really know if with get_page we can do the same, I have seen get_page looks simpler. Right now each request is controlled by an ajax request from front end and then is returned the html cards json that a way (not nearly the best I know) to avoid redo all the front end logic two times (when page loads and when load more is clicked) In that way we are reusing the django template (quicker) instead of fill html with js. I think in a V2 we should go to a full ajax > json way and then change to get_page

Copy link
Contributor

Choose a reason for hiding this comment

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

So I was taking a look go get_page and I think doesn't make change to wait to change, code gets more simpler, making the changes here!

if datarequest == 'mykudos':
context['kudos'] = Token.objects.filter(owner_address=to_checksum_address(address)).order_by(order_by)
paginator = Paginator(context['kudos'], results_per_page)
else :
Copy link
Contributor

Choose a reason for hiding this comment

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

whitespace

Copy link
Contributor

@mbeacom mbeacom left a comment

Choose a reason for hiding this comment

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

yolo 🎲 :shipit:

@mbeacom mbeacom merged commit bb911ee into gitcoinco:master Oct 27, 2018
@octavioamu
Copy link
Contributor

Great job @mbeacom

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.

5 participants