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
Add developer responsiveness badges #774
Add developer responsiveness badges #774
Conversation
|
Thanks for the submission! Let's use the badge titles I outlined in the issue for now: "100% response rate" and "90% response rate". Also, I won't be able to merge this until the third todo item is completed. Without caching the values we end up with a nasty N+1 on Let me know if you have appetite to take care of that. If no, no worries! I can take over. |
|
All noted. After sleeping on this, I'm not loving the dependency on This would solve the N+1 and keep the use of Your thoughts? |
|
That's very similar to what I was thinking, too! We can roll ahead and cache this directly in the Or, we can hold off and wait until that is merged in first. Your call! |
|
Okay, I'll go ahead with the additional table column for now. I've just been looking at #758 and I can't honestly see what problem it is trying to solve? If anything, it will just trigger more db hits for no real gain. Maybe I'm missing something? |
|
It will generate on additional db query per list of developers, instead of one for every badge for every developer. So, for each paginated page of 10 developers it will add 1 additional query. If we had all of the current and upcoming badge logic calculated on the fly it would generate 40 additional queries (4 badges x 10 developers). |
The developer response rate is stored in the `developers` table. This value will be updated a configurable time after a new conversation is intitiated by a Business. This commit includes a migration to add the db column. This commit includes a rake task (rake backfills:developer_response_rate) to be run after the migration.
3cf3379
to
cdc5f88
Compare
A migration is included in this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
I'm now realizing that 90 vs. 100 might not matter very much. Let's consolidate them. If a developer has a 90%+ response rate show a badge that says "High response rate".
Also, it looks like the background job is updating the developer's updated_at column which is used to show the "Recently active" badge. Let's update the job to not update that column for now with a comment explaining why. This will be removed in a future PR when we start to cache the badges in their own model.
I also made some inline questions/comments.
If a developer has a 90%+ response rate show a badge that says "High Response Rate".
Let the job fail on its own when the migration hasn't been run.
Simplify testing now that we are storing the response rate as an actual percentage. Additional tests to check that the grace period for replying to business contacts is being honored.
We are using update_column to avoid changing the updated_at timestamp on the developer record which would trigger the rendering of a 'Recently Active' badge on the developer profile. This should be changed to update! once we have implemented cacheing of the badges in their own model.
|
I've changed the implementation to have a single "High Response Rate" badge as suggested. I noticed that "recently active" was relying on the I noticed that |
|
I'm struggling to get my head around the different queue adaptors (:inline v :async) Any thoughts on how to fix this? |
|
What's even weirder is that when I run Honestly, I'm not really sure what's going on! I'll have to dig in more. |
|
This is what I have learnt in the last few hours.
|
|
Got it! Thanks for identifying all the moving parts - that's helpful. Ignoring the implementation details for a second... when running the seeds ideally the column is populated right away. Meaning, the job kicks off immediately. Is it possible to achieve that? Perhaps via running the job conditionally async/sync depending on the environment? Or something more graceful in the config or options passed to the job? |
|
One option might be to set |
We set the queue adapter to :async for UpdateDeveloperResponseRateJob to avoid a NotImplementedError when seeding Conversations and set the config.developer_response_grace_period to zero so that the jobs are run immediately.
This ensures that the correct developer badges are seen in a freshly seeded development environment
Co-authored-by: Joe Masilotti <joe@masilotti.com>
…ions (joemasilotti#790) * Disable database delivery for business and developer welcome emails * Remove @notification from welcome mailer methods * RailsDevs link to root_url * Update CHANGELOG.md * use subject directly from translations * Point out purpose of PR * Clean up translations and formatting * Remove notifications and just send an email * Enable business welcome emails! * Match order of BusinessMailer * No more notification = no more recipient --------- Co-authored-by: Joe Masilotti <joe@masilotti.com>
The developer response rate is stored in the `developers` table. This value will be updated a configurable time after a new conversation is intitiated by a Business. This commit includes a migration to add the db column. This commit includes a rake task (rake backfills:developer_response_rate) to be run after the migration.
If a developer has a 90%+ response rate show a badge that says "High Response Rate".
Let the job fail on its own when the migration hasn't been run.
Simplify testing now that we are storing the response rate as an actual percentage. Additional tests to check that the grace period for replying to business contacts is being honored.
We are using update_column to avoid changing the updated_at timestamp on the developer record which would trigger the rendering of a 'Recently Active' badge on the developer profile. This should be changed to update! once we have implemented cacheing of the badges in their own model.
We set the queue adapter to :async for UpdateDeveloperResponseRateJob to avoid a NotImplementedError when seeding Conversations and set the config.developer_response_grace_period to zero so that the jobs are run immediately.
This ensures that the correct developer badges are seen in a freshly seeded development environment
This fix will ensure any conversations replied to within the grace period are also included in the response rate calculation.
Co-authored-by: Joe Masilotti <joe@masilotti.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Nice work @fig. Thanks for all the updates.

This PR adds a "responsiveness" badge to a developer's profile.
closes #757
Pull request checklist
bin/checkRequirements from #757
Requires review by someone with better database fu.
Too follow
I'm not totally happy with the text used in the badges so any suggestions for alternatives would be gratefully appreciated.
Current text: "Good responder" / "Perfect responder"
I have chosen to implement this feature by writing a concern to be included in the
Developermodel. The concern utilises the existingStats::Conversationclass to calculate developer response rate.Sample rendering