Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Rewrite of the dashboard reconciliation #3975

Merged
merged 11 commits into from
Nov 23, 2016

Conversation

kaguillera
Copy link
Contributor

This is a rewrite of the reconciliation report in the dashboard directory (gratipay/finances#21) It still needs to be tested on a snapshot of actual data to verify it works properly in production. Any advice on how I can recreate a snapshot of the database to do proper testing

@chadwhitacre
Copy link
Contributor

Rebased on master at c213b9a. Previous head was fdd18d6.

@chadwhitacre chadwhitacre force-pushed the restructure-reconciliation-reports branch from fdd18d6 to c853d65 Compare April 13, 2016 21:44
<td>{{ fmt(balance) }}</td>
<td>{{ fmt(fees) }}</td>
</tr>
{% for month, recs in by_month|dictsort %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice. Is this a Jinja2 thing?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes.

@chadwhitacre
Copy link
Contributor

I see balanced-cc in 2012-07 as the first month and network. We should have all exchanges on this report, regardless of whether they have a route or not. A subhead for "no route" would actually be helpful in working through #3912.

@chadwhitacre
Copy link
Contributor

@kaguillera
Copy link
Contributor Author

kaguillera commented Apr 14, 2016

So these are the steps I think I have to make to show the null values in the dashboard reconciliation page:

  • Create and branch.sql in local /sql/ folder to alter exchanges and payment_net
    • Alter exchange_status and payment_net by adding ‘ unknown’ type to enum
    • Insert records for ‘unknown’ network in exchange_route table
    • Update exchanges records with exchange_route ids pointing to ‘unknown’ network records for that participants
    • Update all null exchange_status to ‘ unknown'
    • Alter exchanges table and set status to not null
    • Alter exchange_routes table and set route to not null
  • run and test changes made locally
  • commit changes once satisfied it is working properly

@kaguillera
Copy link
Contributor Author

This last commit is the changes made to database in order to capture the NULL values for route in the exchanges table that are not show on the reconciliation page. I tested it here but need real data as before so please review @whit537 as before... scratch I still have some worked based on the failed travis. I will look at it over the weekend.

@chadwhitacre
Copy link
Contributor

Redid 35fc223 as c370b0d to uncomment SQL per IRL convo w/ @kaguillera.

@ghost
Copy link

ghost commented Jul 21, 2016

@whit537 : is the reconciliation page supposed to be public, since it's in the dashboard? Just to be sure.

@chadwhitacre
Copy link
Contributor

Yeah, if I remember right, earlier in the PR we had two sections on the reconciliation dashboard, one aggregate and one more detailed. The detailed one we wanted to protect, but I'm pretty sure it's gone now. We're okay with the aggregate numbers being public.

@ghost
Copy link

ghost commented Jul 21, 2016

Ok, thanks for the reply ;-)

@kaguillera kaguillera force-pushed the restructure-reconciliation-reports branch from 71e325a to 3a99242 Compare September 9, 2016 19:05
@kaguillera
Copy link
Contributor Author

kaguillera commented Sep 9, 2016

Finally started back working on this and realize(Trinidad/UK spelling) the reason for the error on Travis.
In fake_data.py the fake_exchange function does not associate the exchange with a fake_exchange_route. Thus to solve it I have to make the fake_exchange_routes for the fake participants and then associate (foreign_key reference) them with the fake exchanges that are created for that participant. So here goes...

@kaguillera
Copy link
Contributor Author

Now this is finally up for review since travis is passing. ping @whit537

@chadwhitacre
Copy link
Contributor

@kaguillera Ready for a rebase post-#3596, ya?

@kaguillera
Copy link
Contributor Author

Let me just verify this and get back to you...

@kaguillera kaguillera force-pushed the restructure-reconciliation-reports branch from 1a3f844 to 3a99242 Compare September 21, 2016 20:10
@kaguillera
Copy link
Contributor Author

Finally ready for review and merging.

@chadwhitacre
Copy link
Contributor

Need another rebase. 🐑

@chadwhitacre
Copy link
Contributor

Talking through git wonkiness here. Trying to understand where the infamous "@kaguillera has added 250+ commits" is coming from. Planning to pick up tomorrow ...

@kaguillera kaguillera force-pushed the restructure-reconciliation-reports branch from 3a99242 to 00b0f2b Compare September 22, 2016 15:38
@kaguillera
Copy link
Contributor Author

🎉 No more conflicts 🎉 ready for review again

@@ -0,0 +1,163 @@
import calendar
Copy link
Contributor

Choose a reason for hiding this comment

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

What's up with this reconciliation_new.spt file? Is it supposed to replace reconciliation.spt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reconciliation_new.spt is a scratch file that I need to (and going to now) remove. Originally it was going to be a separate page but decided against it I actually thought that I had removed it.

@chadwhitacre
Copy link
Contributor

Weird. Green again! O.O

@chadwhitacre chadwhitacre mentioned this pull request Nov 23, 2016
@kaguillera kaguillera force-pushed the restructure-reconciliation-reports branch from 5fcee84 to bd7fd89 Compare November 23, 2016 20:48
@kaguillera kaguillera force-pushed the restructure-reconciliation-reports branch from bd7fd89 to 0eb41a4 Compare November 23, 2016 20:51
@kaguillera
Copy link
Contributor Author

Rebased

@kaguillera
Copy link
Contributor Author

Ready again...what is the verdict...can we merge?

-- network in exchange_route table
INSERT INTO exchange_routes (participant, network, address, error)
(
SELECT DISTINCT participants.id, 'unknown'::payment_net, 'None', 'None'
Copy link
Contributor

Choose a reason for hiding this comment

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

Goofy to use the string "None" here. I think the empty string might be a better choice?

Copy link
Contributor

Choose a reason for hiding this comment

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

There's a uniqueness constraint on (participant, network, address), which is why non-unique (network, address) is fine.

gratipay-bak=# \d exchange_routes
                                Table "public.exchange_routes"
┌─────────────┬───────────────┬──────────────────────────────────────────────────────────────┐
│   Column    │     Type      │                          Modifiers                           │
├─────────────┼───────────────┼──────────────────────────────────────────────────────────────┤
│ id          │ integernot null default nextval('exchange_routes_id_seq'::regclass) │
│ participant │ bigintnot null                                                     │
│ network     │ payment_net   │ not null                                                     │
│ address     │ textnot null                                                     │
│ error       │ textnot null                                                     │
│ fee_cap     │ numeric(35,2) │                                                              │
└─────────────┴───────────────┴──────────────────────────────────────────────────────────────┘
Indexes:
    "exchange_routes_pkey" PRIMARY KEY, btree (id)
    "exchange_routes_participant_network_address_key" UNIQUE CONSTRAINT, btree (participant, network, address)
Check constraints:
    "exchange_routes_address_check" CHECK (address <> ''::text)
Foreign-key constraints:
    "exchange_routes_participant_fkey" FOREIGN KEY (participant) REFERENCES participants(id)
Referenced by:
    TABLE "exchanges" CONSTRAINT "exchanges_route_fkey" FOREIGN KEY (route) REFERENCES exchange_routes(id)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Soooo...if we replace the None for address and error will that be sufficient or do you still have some concerns

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, let's switch to n/a for address and the empty string for error.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done in bac13de.

Change default values for route address and error (and tweak comment)
@chadwhitacre
Copy link
Contributor

Alright, I'm good here. I'm satisfied that we don't have code inserting new NULL routes or statuses, and I'm seeing this do what's intended in terms of converting existing NULLs to unknown. Deploying! 👍

@chadwhitacre chadwhitacre merged commit 32ebb9a into master Nov 23, 2016
@chadwhitacre chadwhitacre deleted the restructure-reconciliation-reports branch November 23, 2016 21:54
chadwhitacre added a commit that referenced this pull request Nov 23, 2016
chadwhitacre added a commit that referenced this pull request Nov 24, 2016
chadwhitacre added a commit that referenced this pull request Nov 24, 2016
chadwhitacre added a commit that referenced this pull request Nov 24, 2016
clone1018 added a commit that referenced this pull request Nov 25, 2016
@kaguillera kaguillera mentioned this pull request May 19, 2017
15 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants