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

GITC-242 chore: improve grants search using SearchVectorField #9314

Merged
merged 2 commits into from
Aug 16, 2021

Conversation

thelostone-mc
Copy link
Member

@thelostone-mc thelostone-mc commented Jul 22, 2021

Description

Right now we use .keywords to do a text search by keyword when we explore vector column but we've often gotten complaints that our search is horrible and doesn't work as expected
Came across this article where folks using SearchVectorField

With a little playing around, I was able to test and show that

  • More accurate results
  • Quicker Lookup time // check video link below
    • Current Search using keywords : 0.048 sec
    • Search using SearchVectorField : 0.021 sec

For this what we do here is

  1. pick out the column we would like to be searchable (title + description)
  2. assign them weights (title has more weightage)
  3. convert them into lexicals and store them in SearchVectorField column called vector_column using to_tsvector
  4. use this column to run searches against

NOTE: This data is best tested on shell as opposed to UI cause the weighted average order gets messed up cause of the sort which happens due to SORT

Refers/Fixes
Callouts

The custom migration file was created using triggers. The command was
docker-compose exec web python3 app/manage.py makemigrations grants -n create_trigger --empty

Triggers are obsolete in postgres 12 -> but we are on 10.
https://stackoverflow.com/questions/59675402/django-full-text-searchvectorfield-obsolete-in-postgresql

Testing

I've additionally tested the flows to ensure

  • Overall flow
  • SearchVectorField is set during grant creation
  • SearchVectorField gets updated when a grant title / description is upated

While I have tested this to my best extent. I would love for the team to help out with some additional testing
VIDEO (HAS AUDIO) : https://share.vidyard.com/watch/oE6HaoRPB51FHYMFcry7bw?

from django.db import connection, reset_queries
from grants.models import Grant
from django.contrib.postgres.search import SearchQuery, SearchRank, SearchVector
from pprint import pprint as pp

reset_queries()

# screen 1 
Grant.objects.keyword("gitcoin")


# screen 2
Grant.objects.filter(vector_column="gitcoin")
pp(connection.queries)

For a Grant with

  • Title: SOMTHING MORE
  • Description: Random Smoking papa kush
  • Search vector generated => 'kush':6 'papa':5 'random':3 'smoke':4 'somth':1

GITC-242

@thelostone-mc thelostone-mc changed the title chore: improve grants search using vector_column chore: improve grants search using SearchVectorField Jul 23, 2021
@thelostone-mc thelostone-mc marked this pull request as ready for review July 23, 2021 07:42
@thelostone-mc thelostone-mc marked this pull request as draft July 23, 2021 07:59
@thelostone-mc thelostone-mc marked this pull request as ready for review July 26, 2021 09:56
@thelostone-mc thelostone-mc changed the title chore: improve grants search using SearchVectorField GITC-242 chore: improve grants search using SearchVectorField Jul 26, 2021
Copy link
Contributor

@zlsgh zlsgh left a comment

Choose a reason for hiding this comment

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

LGTM
I deployed locally, but don't have enough grants data to really test it out. We should test on staging.

Copy link
Contributor

@gdixon gdixon left a comment

Choose a reason for hiding this comment

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

LGTM!! 🚀

Copy link
Contributor

@octavioamu octavioamu left a comment

Choose a reason for hiding this comment

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

tested inside the grant filters changes , working great.

@zlsgh zlsgh merged commit 0941940 into gitcoinco:master Aug 16, 2021
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Aug 16, 2021
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Aug 18, 2021
zlsgh pushed a commit that referenced this pull request Aug 25, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 13, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 13, 2021
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 14, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 14, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 17, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
gdixon pushed a commit that referenced this pull request Sep 27, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* remove original models.py

* resolve eslint error breaking CI build
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 27, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit that referenced this pull request Sep 27, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 27, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 27, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 27, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 27, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 27, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 27, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 27, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 27, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 27, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 27, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 27, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 28, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
thelostone-mc pushed a commit that referenced this pull request Sep 29, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* add pytest-factoryboy

* add test directory for models and directory for factories

* add initial test for donation model

* add test case for from_address

* test donation has a to_address

* add test case for relation to profile

* add test case for token_address

* add test case for donation.token_symbol

* add test case for donation.token_amount

* add test case for donation.token_amount_usdt

* add test case for donation.tx_id

* add test case for donation.network

* add test cases for donation_percentage and subscription

* add test case for relation to contribution

* remove some whitespace

* refactor and add docstrings

* refactor

* refactor
thelostone-mc added a commit that referenced this pull request Sep 29, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* add pytest-factoryboy

* add directories for tests and factories

* add initial test for CartActivity

* add test case for relation to Grant

* add test case for relation to Profile

* add test case for 'action' attribute

* add test case for 'metadata' attribute

* add test case for 'bulk' attribute

* add test case for 'latest' attribute

* add pytest

* add tests for CartActivity, add factory for CartActivity and Profile

* add test case for 'latest' attribute

* add test for relationship to Grant

* add factory for Profile

* refactor

* refactor

* refactor

* add assertions

* refactor

* refactor

* fix duplicate dependency

Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>
thelostone-mc added a commit that referenced this pull request Sep 29, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* add pytest-factoryboy

* add initial test for CLRMatch

* add unit test for 'round_number'

* add test case for 'amount' attribute

* test CLRMatch has associated grant

* add test case for has_passed_kyc attr

* add test case for 'ready_for_test_payout' attr

* add test case for test_payout_tx

* add test case for test_payout_tx_date

* add test case for test_payout_contribution

* add test case for 'ready_for_payout'

* add test case for payout_tx

* add test case for payout_tx_date

* refactor and add test case for payout_contribution

* add test case for comments

* refactor

Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>
thelostone-mc added a commit that referenced this pull request Sep 29, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* add pytest-factoryboy

* add directory structure for models testing and factories

* add initial test

* stub out test cases

* add docstrings and factories

* add assertions for policy_name attribute

* add assertions for url_pattern

* refactor and add assertions for banner_image

* add assertions for priority, background_image, inline_css

* fix typo

* refactor

* Update grant.py

Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>
thelostone-mc added a commit that referenced this pull request Sep 29, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* add pytest-factoryboy to requirements

* add models and factories directories

* add initial test

* test association with Grant

* test data attribute

* add test case for snapshot_type

* refactor

* Update grant.py

Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>
thelostone-mc added a commit that referenced this pull request Sep 29, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* add pytest-factoryboy

* add directories

* add initial test case

* add test case for 'latest' attribute

* add test case for associated Grant

* add test case for associated GrantCLR

* add test case for 'clr_prediction_curve'

* refactor

* Update grant.py

Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>
jeremyschuurmans pushed a commit to jeremyschuurmans/web that referenced this pull request Sep 29, 2021
* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from gitcoinco#9314

* add try/except to migration file instead of editing migration directly

* refactor
thelostone-mc pushed a commit that referenced this pull request Sep 29, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* add pytest-factoryboy and directories

* add factory and initial test case

* add test case for 'category' attribute

* refactor

* add missing checkout_type (present in migration but not in model)
thelostone-mc pushed a commit that referenced this pull request Sep 29, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* add initial test case

* add test case for associated Grant

* add test case for associated Profile

* add test case for comments

* add test case for processed attribute

* add test case for comments_admin

* add test case for tweet

* add test case for post_flag() method

* refactor test for post_flag() method

* refactor

* add missing checkout_type (present in migration but not in model)
gdixon added a commit that referenced this pull request Sep 29, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* add pytest-factoryboy

* add directories and test files

* add initial test

* add test for company_name

* fix typo

* add test for round_num

* add test for sub_round_slug

* add tests for display_text and owner

* add test case for owner attribute

* add test for is_active attribute

* add test for start_date

* add test for end_date

* add test for grant_filters

* add test for subscription_filters

* add test for collection_filters

* add test for verified_threshold

* add test for unverified_threshold

* add test for total_pot

* add test for contribution_multiplier

* add test for logo

* add test for happening_now

* add test for happening_now returning false

* fix typo

* add tests for happened_recently

* add test for record_clr_prediction_curve

* add test for grants method

* add test case for grants method

* add test case for grants method

* add test case for grants method

* add test case for grants method

Co-authored-by: Graham Dixon <graham@gitcoin.co>
gdixon added a commit that referenced this pull request Sep 29, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* add pytest-factoryboy

* add directories and test files

* add initial test

* add test for grants

* add test for profile

* add test for title

* add test for description

* add test for cover

* add test for hidden attribute

* add test for cache

* add test for featured

* add test for shuffle_rank

* add test for curators

* refactor

Co-authored-by: Graham Dixon <graham@gitcoin.co>
gdixon pushed a commit that referenced this pull request Sep 29, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* add pytest-factoryboy

* create directories and test files

* add initial test case

* fix typo

* add test for key

* add test for secret attribute

* add test for profile

* refactor

* refactor
gdixon added a commit that referenced this pull request Sep 29, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* add pytest-factoryboy

* add initial test

* add test case for 'active' attribute

* add test for profile attribute

* add test case for 'amount'

* add test for pledge_type attribute

* add test case for comments

* refactor

* add test case for 'end_date' attribute

* add test case for 'data' attribute

* add test case for 'clr_round_num'

* add test case for data_json property

* remove unnecessary import

* refactor

Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>
Co-authored-by: Graham Dixon <graham@gitcoin.co>
gdixon pushed a commit that referenced this pull request Sep 29, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* add pytest-factoryboy to requirements

* add test directory

* add initial test case

* add test case for 'name'

* test 'label' attribute

* test 'is_active' attribute

* add test case for 'is_visible' attribute

* run one test instead of entire test suite

* add test case for relation to GrantCategory

* test 'logo' attribute

* add initial test for clrs method

* add initial test for active_clrs method

* add test for active_clrs_sum method

* add docstrings

* refactor

* refactor

* refactor

* refactor

* refactor

* fix failing test
thelostone-mc pushed a commit that referenced this pull request Sep 29, 2021
* Extract grants models into individual files (#9341)

* create new directory for models, copy over Contribution model

* extract grants models to individual files

* rename relocated_models directory, remove original models directory, add imports, resolve circular dependencies

* extract CLRMatch into separate file

* extract Flag into separate file

* extract MatchPledge to separate file

* extract Donation and PhantomFunding

* extract GrantStat into separate file

* refactor

* extract GrantBrandingRoutingPolicy to separate file

* update migration

* add missing import to MatchPledge, remove imports from __init__.py

* add missing import

* decouple GrantCLRCalculation and move to own file

* extract GrantType to own file

* extract GrantCLR to own file

* add missing import

* refactor, add missing imports

* remove whitespace

* resolve circular dependency

* run 'make fix'

* import changes from #9314

* add try/except to migration file instead of editing migration directly

* refactor

* remove PhantomFunding model

* remove imports and calls to PhantomFunding

* remove references to PhantomFunding in scripts/debug/address_usage_finder.py

* run migration deleting PhantomFunding model

* replace GrantCategory with GrantTag in admin.py

* resolve conflict resulting in CI failure
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