Closed jeremybmerrill closed 6 years ago
One thing that may be worth doing is figuring out if we want the time period for "recent" to be a month or a week -- or both.
One thing I'd love your help on, Jeff, is figuring out how to not repeat myself as much in server.rs
, where get_advertisers() and get_recent_advertisers are almost identical. Is this where I'd use a macro? Or should I pass a block into a generic getter method (where the differences between the two methods are contained in that block)?
@thejefflarson 4a268b0 has an attempt at passing a closure into a more generic (but not a "generic" generic) method for getting Advertisers. It still returns one error about the closure not implementing std::marker::Sync. Your thoughts appreciated.
I've also included the Segment stuff (gender -> men; age -> 18=65 or whatever). We may want to, instead of doing as I've done it here, have a different method that takes a closure for taking a method and returning an ApiResponse struct -- and just use the putative new method for dealing with CpuPools, response haeders and HTTP errors.
Ok. I think we're going about this the wrong way. It doesn't make sense to return an ApiResponse for everything. We should have structured responses to each type of thing. I'm gunna hack away at this and see if I can get something else going.
FYI, I took the opportunity to clean up the mess in server and am almost done, will push tomorrow.
Ok take a look now. I got advertisers working, but segments is throwing a postgres error, are you using pg 10 in development?
Okay, I think this is ready to go for the Advertisers aggregate? (And Tools page, which just has a link to the Advertisers aggregate and Advertisers recent aggregate -- plus a link to Trump ads... hopefully more once we turn back to the site.)
Cool!
This creates a Tools page in the Admin with links to various pages that'll hopefully help surface interesting ads. http://localhost:8080/facebook-ads/admin/tools.
So far, that has a link to see all Trump ads and a page for seeing counts of ads per advertiser -- overall and in the past month. I aim to add more (including some stuff that's not ready but that you're nevertheless welcome to take a look at in feature/segmentaggregates).
Includes tests. Thoughts?