maiera / gde-app

Apache License 2.0
22 stars 9 forks source link

Expose raw_impact on activity_record #190

Closed SmokyBob closed 9 years ago

SmokyBob commented 9 years ago

As a requirement to implement #189 the raw_impact on the activity is needed from the backend on the activity_record.

This info is needed for the data_dump for internal Google Analysis (Google Sheet for Marie)

Scarygami commented 9 years ago

Do we want this to be sortable (as with total_impact as a computed property) or is an alias property that is computed on the fly by the backend enough? For computed property all the entries would have to be re-put to store it (but we have an admin task for that already anyway so no biggy).

Also, what number are we looking for exactly?

1 + sum(social_impact) + sum(meta_impact)?

I've been thinking that maybe for the display in the frontend having three columns as social impact, meta impact, and total impact would make the most sense. Having +1's/comments/reshares displayed separately doesn't add so much value, but having the raw meta_impact would make sense.

Having those two values separately displayed in the UI would also help to see what activities don't have any metadata applied yet.

Maybe we could reflect this in the backend accordingly with two extra computed/alias properties

social_impact = plusones + reshares + comments meta_impact = sum(meta impact values)

(Of course both those values could be easily calculated in the front-end as well)

Thoughts?

SmokyBob commented 9 years ago

I think having the 2 additional columns is an awesome idea! :+1: :+1: This way explaining how the total impact is calculated will be even more clear.

The reason behind having these values calculated on the backend is to make sure the same "algorithm" is used when displaying the values on the front end or exporting them to the data_dump, instead of implementing it in 2 different places (mostly thinking about the meta_impact that might be different depending on product and activity_type in the nearish future).

patt0 commented 9 years ago

I deployed the code to the staging environment and everything went well as far as I could see https://elite-firefly-737.appspot.com/_ah/api/gdetracking/v1.0b2/activityRecord/activityRecord

I then bravely went on to deploy on the production and :-1: https://omega-keep-406.appspot.com/_ah/api/gdetracking/v1.0b2/activityRecord/activityRecord

I forgot that we had not yet deployed the delete code https://github.com/maiera/gde-app/pull/184 ... so all the activity records have a null entry in the deleted field @Scarygami @SmokyBob how did you / we update the AR on the staging environment? I can apply the same method for production

While I was doing looking into this the logs showed that the /tasks/calc_impact ran well, but that some other error was happening in the /tasks/upd_gplus cron for quite a number of days (about 2 weeks) ... i guess I should be monitoring the app more ofter :(

These entries have a bad email for some reason https://appengine.google.com/datastore/edit?app_id=s~omega-keep-406&version_id=3.381852766532005773&key=ahBzfm9tZWdhLWtlZXAtNDA2ciILEgdBY2NvdW50IhUxMTQxODIxOTYyNjA1NTk0NDQ0NzUM https://appengine.google.com/datastore/edit?app_id=s~omega-keep-406&version_id=3.381852766532005773&key=ahBzfm9tZWdhLWtlZXAtNDA2ciILEgdBY2NvdW50IhUxMTQyMzE0NDg4NzYwMjM0NDE1MzcM

Until we correct these two entries I have uploaded a change to production that issues a warning in case of an email for a bad post not being sent.

SmokyBob commented 9 years ago

@patt0 in the staging Environment I've run a JS script that updated all activities since Jan 2013 setting the deleted field to False.

Script is currently running. Will Update when it's done