diff --git a/backend/app/bindings/api/v1/bindings/user_preferences.rb b/backend/app/bindings/api/v1/bindings/user_preferences.rb
index ff5151891..e37b45f20 100644
--- a/backend/app/bindings/api/v1/bindings/user_preferences.rb
+++ b/backend/app/bindings/api/v1/bindings/user_preferences.rb
@@ -15,11 +15,8 @@
module Api::V1::Bindings
class UserPreferences
- # User wishes to receive email about cycle deadlines
- attr_accessor :cycle_deadlines_email
-
- # User wishes to receive email about price deadlines
- attr_accessor :prize_cycle_email
+ # User wishes to receive email when new digital badge becomes available
+ attr_accessor :digital_badge_available_email
# User wishes to receive email about study availibility
attr_accessor :study_available_email
@@ -36,8 +33,7 @@ class UserPreferences
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
- :'cycle_deadlines_email' => :'cycle_deadlines_email',
- :'prize_cycle_email' => :'prize_cycle_email',
+ :'digital_badge_available_email' => :'digital_badge_available_email',
:'study_available_email' => :'study_available_email',
:'session_available_email' => :'session_available_email',
:'has_viewed_analysis_tutorial' => :'has_viewed_analysis_tutorial',
@@ -53,8 +49,7 @@ def self.acceptable_attributes
# Attribute type mapping.
def self.openapi_types
{
- :'cycle_deadlines_email' => :'Boolean',
- :'prize_cycle_email' => :'Boolean',
+ :'digital_badge_available_email' => :'Boolean',
:'study_available_email' => :'Boolean',
:'session_available_email' => :'Boolean',
:'has_viewed_analysis_tutorial' => :'Boolean',
@@ -83,12 +78,8 @@ def initialize(attributes = {})
h[k.to_sym] = v
}
- if attributes.key?(:'cycle_deadlines_email')
- self.cycle_deadlines_email = attributes[:'cycle_deadlines_email']
- end
-
- if attributes.key?(:'prize_cycle_email')
- self.prize_cycle_email = attributes[:'prize_cycle_email']
+ if attributes.key?(:'digital_badge_available_email')
+ self.digital_badge_available_email = attributes[:'digital_badge_available_email']
end
if attributes.key?(:'study_available_email')
@@ -126,8 +117,7 @@ def valid?
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
- cycle_deadlines_email == o.cycle_deadlines_email &&
- prize_cycle_email == o.prize_cycle_email &&
+ digital_badge_available_email == o.digital_badge_available_email &&
study_available_email == o.study_available_email &&
session_available_email == o.session_available_email &&
has_viewed_analysis_tutorial == o.has_viewed_analysis_tutorial &&
@@ -143,7 +133,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [cycle_deadlines_email, prize_cycle_email, study_available_email, session_available_email, has_viewed_analysis_tutorial, has_viewed_welcome_message].hash
+ [digital_badge_available_email, study_available_email, session_available_email, has_viewed_analysis_tutorial, has_viewed_welcome_message].hash
end
# Builds the object from hash
diff --git a/backend/app/controllers/api/v1/preferences_open_api.rb b/backend/app/controllers/api/v1/preferences_open_api.rb
index 2f9429631..432f2fb7c 100644
--- a/backend/app/controllers/api/v1/preferences_open_api.rb
+++ b/backend/app/controllers/api/v1/preferences_open_api.rb
@@ -6,13 +6,9 @@ class Api::V1::PreferencesOpenApi
openapi_component do
schema :UserPreferences do
- property :cycle_deadlines_email do
+ property :digital_badge_available_email do
key :type, :boolean
- key :description, 'User wishes to receive email about cycle deadlines'
- end
- property :prize_cycle_email do
- key :type, :boolean
- key :description, 'User wishes to receive email about price deadlines'
+ key :description, 'User wishes to receive email when new digital badge becomes available'
end
property :study_available_email do
key :type, :boolean
diff --git a/backend/app/services/learner_activity_report.rb b/backend/app/services/learner_activity_report.rb
index 19f1a2fbb..2469149b4 100644
--- a/backend/app/services/learner_activity_report.rb
+++ b/backend/app/services/learner_activity_report.rb
@@ -30,6 +30,8 @@ def build_headers(csv)
'Participant Created At',
'Participant Research ID',
'New Participant Study?',
+ 'Participant UUID',
+ 'Participant Name',
'Test Account?'
]
end
@@ -86,6 +88,8 @@ def build_rows(csv, users, launches)
launch.research_id.created_at,
launch.research_id.id,
launch.research_id.is_new_user?(launch.first_launched_at),
+ launch.user_id,
+ account['name'] || '',
account['is_test'] ? 'X' : nil
]
end
diff --git a/backend/db/migrate/20241219132405_update_user_preferences.rb b/backend/db/migrate/20241219132405_update_user_preferences.rb
new file mode 100644
index 000000000..6aff130f1
--- /dev/null
+++ b/backend/db/migrate/20241219132405_update_user_preferences.rb
@@ -0,0 +1,8 @@
+class UpdateUserPreferences < ActiveRecord::Migration[7.1]
+ def change
+ remove_column :user_preferences, :prize_cycle_email, :boolean
+ remove_column :user_preferences, :cycle_deadlines_email, :boolean
+
+ add_column :user_preferences, :digital_badge_available_email, :boolean, default: false, null: false
+ end
+end
diff --git a/backend/db/structure.sql b/backend/db/structure.sql
index 5a5c556df..ded27b728 100644
--- a/backend/db/structure.sql
+++ b/backend/db/structure.sql
@@ -779,14 +779,13 @@ ALTER SEQUENCE public.study_researchers_id_seq OWNED BY public.study_researchers
CREATE TABLE public.user_preferences (
id bigint NOT NULL,
user_id uuid NOT NULL,
- cycle_deadlines_email boolean DEFAULT false NOT NULL,
- prize_cycle_email boolean DEFAULT false NOT NULL,
study_available_email boolean DEFAULT false NOT NULL,
session_available_email boolean DEFAULT true NOT NULL,
created_at timestamp(6) with time zone NOT NULL,
updated_at timestamp(6) with time zone NOT NULL,
has_viewed_analysis_tutorial boolean DEFAULT false,
- has_viewed_welcome_message boolean DEFAULT false
+ has_viewed_welcome_message boolean DEFAULT false,
+ digital_badge_available_email boolean DEFAULT false NOT NULL
);
@@ -1477,6 +1476,7 @@ ALTER TABLE ONLY public.response_exports
SET search_path TO "$user", public;
INSERT INTO "schema_migrations" (version) VALUES
+('20241219132405'),
('20240718193802'),
('20240718103317'),
('20240712192733'),
diff --git a/backend/spec/requests/api/v1/preferences_spec.rb b/backend/spec/requests/api/v1/preferences_spec.rb
index 6f22a6d9e..090a8ede5 100644
--- a/backend/spec/requests/api/v1/preferences_spec.rb
+++ b/backend/spec/requests/api/v1/preferences_spec.rb
@@ -24,8 +24,7 @@
expect(response).to have_http_status(:ok)
expect(response_hash).to match(
a_hash_including(
- cycle_deadlines_email: false,
- prize_cycle_email: false,
+ digital_badge_available_email: false,
session_available_email: true,
study_available_email: false
)
@@ -37,13 +36,12 @@
before { stub_current_user(user_id) }
it 'returns their saved preferences' do
- UserPreferences.create!(user_id:, cycle_deadlines_email: true)
+ UserPreferences.create!(user_id:, digital_badge_available_email: true)
get '/api/v1/preferences'
expect(response).to have_http_status(:ok)
expect(response_hash).to match(
a_hash_including(
- cycle_deadlines_email: true,
- prize_cycle_email: false,
+ digital_badge_available_email: true,
session_available_email: true,
study_available_email: false
)
@@ -56,7 +54,7 @@
describe 'update' do
context 'when no user is logged in' do
it 'rejects the request' do
- post '/api/v1/preferences', params: { preferences: { cycle_deadlines_email: false } }
+ post '/api/v1/preferences', params: { preferences: { digital_badge_available_email: true } }
expect(response).to have_http_status(:unauthorized)
end
end
@@ -66,13 +64,13 @@
it 'updates' do
expect {
- post '/api/v1/preferences', params: { preferences: { cycle_deadlines_email: false } }
+ post '/api/v1/preferences', params: { preferences: { digital_badge_available_email: true } }
expect(response).to have_http_status(:accepted)
}.to change { UserPreferences.count }.by(1)
- expect(UserPreferences.for_user_id(user_id).cycle_deadlines_email).to be false
+ expect(UserPreferences.for_user_id(user_id).digital_badge_available_email).to be true
- post '/api/v1/preferences', params: { preferences: { cycle_deadlines_email: true } }
- expect(UserPreferences.for_user_id(user_id).cycle_deadlines_email).to be true
+ post '/api/v1/preferences', params: { preferences: { digital_badge_available_email: false } }
+ expect(UserPreferences.for_user_id(user_id).digital_badge_available_email).to be false
end
it 'updates the settings' do
diff --git a/frontend/src/api/models/UserPreferences.ts b/frontend/src/api/models/UserPreferences.ts
index 9fe384724..01c0b96a2 100644
--- a/frontend/src/api/models/UserPreferences.ts
+++ b/frontend/src/api/models/UserPreferences.ts
@@ -20,17 +20,11 @@ import { exists, mapValues } from '../runtime';
*/
export interface UserPreferences {
/**
- * User wishes to receive email about cycle deadlines
+ * User wishes to receive email when new digital badge becomes available
* @type {boolean}
* @memberof UserPreferences
*/
- cycleDeadlinesEmail?: boolean;
- /**
- * User wishes to receive email about price deadlines
- * @type {boolean}
- * @memberof UserPreferences
- */
- prizeCycleEmail?: boolean;
+ digitalBadgeAvailableEmail?: boolean;
/**
* User wishes to receive email about study availibility
* @type {boolean}
@@ -76,8 +70,7 @@ export function UserPreferencesFromJSONTyped(json: any, ignoreDiscriminator: boo
}
return {
- 'cycleDeadlinesEmail': !exists(json, 'cycle_deadlines_email') ? undefined : json['cycle_deadlines_email'],
- 'prizeCycleEmail': !exists(json, 'prize_cycle_email') ? undefined : json['prize_cycle_email'],
+ 'digitalBadgeAvailableEmail': !exists(json, 'digital_badge_available_email') ? undefined : json['digital_badge_available_email'],
'studyAvailableEmail': !exists(json, 'study_available_email') ? undefined : json['study_available_email'],
'sessionAvailableEmail': !exists(json, 'session_available_email') ? undefined : json['session_available_email'],
'hasViewedAnalysisTutorial': !exists(json, 'has_viewed_analysis_tutorial') ? undefined : json['has_viewed_analysis_tutorial'],
@@ -94,8 +87,7 @@ export function UserPreferencesToJSON(value?: UserPreferences | null): any {
}
return {
- 'cycle_deadlines_email': value.cycleDeadlinesEmail,
- 'prize_cycle_email': value.prizeCycleEmail,
+ 'digital_badge_available_email': value.digitalBadgeAvailableEmail,
'study_available_email': value.studyAvailableEmail,
'session_available_email': value.sessionAvailableEmail,
'has_viewed_analysis_tutorial': value.hasViewedAnalysisTutorial,
diff --git a/frontend/src/screens/account-details.tsx b/frontend/src/screens/account-details.tsx
index 28cf796c3..c7859cd89 100644
--- a/frontend/src/screens/account-details.tsx
+++ b/frontend/src/screens/account-details.tsx
@@ -123,16 +123,9 @@ export default function AccountDetails() {
-
-