Skip to content

Conversation

@qiyi-jiang
Copy link
Collaborator

No description provided.

@qiyi-jiang qiyi-jiang requested a review from fny November 30, 2020 19:11
Copy link
Owner

@fny fny left a comment

Choose a reason for hiding this comment

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

Did realize these stay as pending

@@ -0,0 +1,21 @@
# frozen_string_literal: true
class StatusNotifyWorker < ApplicationWorker
Copy link
Owner

Choose a reason for hiding this comment

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

We need a better name for this and NotifyWorker. It's really confusing right now.

Maybe StatusAlertAdminsWorkers and StatusAlertUserWorker?

users_to_notify = Set.new

locations.map(&:location_accounts).flatten.each do |la|
if la.role.admin? && la.user.id != notify_except
Copy link
Owner

Choose a reason for hiding this comment

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

What does != notify_except do?

Copy link
Collaborator Author

@qiyi-jiang qiyi-jiang Dec 7, 2020

Choose a reason for hiding this comment

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

@fny It excludes the user who submitted the status. I thought he/she wouldn't have to be notified about the submission he/she made. Let me know if I was wrong. And I see that the submitter can be different from the person of the symptom - sometimes even an administrator.

expect(response_json).to have_key(:data)
expect(response_json[:data][:attributes]).to include(status: 'pending')
expect(user.last_greenlight_status.status).to eq(GreenlightStatus::PENDING)
expect_work(StatusNotifyWorker)
Copy link
Owner

Choose a reason for hiding this comment

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

Can we also check that the proper users have received an email?

@@ -0,0 +1,39 @@
# frozen_string_literal: true
class NotifyWorker < ApplicationWorker
Copy link
Owner

Choose a reason for hiding this comment

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

Need a better name

def perform(user_id, symptom_holder_id, status)
user = User.find(user_id)
symptom_holder = User.find(symptom_holder_id)
status_color = status == 'pending' ? 'Yellow' : 'Red'
Copy link
Owner

Choose a reason for hiding this comment

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

Make this an I18n translation for all the following. I've added the spanish

"GreenlightStatus.absent": "Ausente",
"GreenlightStatus.cleared": "Aprobado",
"GreenlightStatus.not_submitted": "No Enviado",
"GreenlightStatus.pending": "Pendiente",
"GreenlightStatus.recovery": "Recuperación",

"GreenlightStatus.cleared_color": "Aprobado",
"GreenlightStatus.not_submitted_color": "No Enviado",
"GreenlightStatus.pending_color": "Pendiente",
"GreenlightStatus.recovery": "Recuperación",

The ouptut format should be "type (color)" for example "Recovery (Red)".

GreenlightStatus.red 'rojo'
GreenlightStatus.yellow 'amarillo'
GreenlightStatus.green 'verde'

@qiyi-jiang qiyi-jiang requested a review from fny December 7, 2020 16:14
Copy link
Owner

@fny fny left a comment

Choose a reason for hiding this comment

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

I'm going to merge this into the next release.

@fny fny added the notreleased feature that hasn't been released for one reason or another label Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notreleased feature that hasn't been released for one reason or another

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Send email notifications to administrators for yellow or red statuses (1)

3 participants