Skip to content

Commit

Permalink
[DO NOT PUSH] Add dev test data
Browse files Browse the repository at this point in the history
  • Loading branch information
ammopt committed Nov 7, 2024
1 parent d9b5c43 commit 8059f6c
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions code/web/sys/DBMaintenance/community_engagement_updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,55 @@ function getCommunityEngagementUpdates() {
"INSERT INTO role_permissions(roleId, permissionId) VALUES ((SELECT roleId from roles where name='opacAdmin'), (SELECT id from permissions where name='View Community Dashboard'))"
],
],
# !! DEV ONLY !!
'add_test_data' => [
'title' => 'Add Test Data',
'description' => 'Add test data to the community engagement tables',
'sql' => [
# Insert campaigns
"INSERT INTO ce_campaign (name, description, startDate, endDate) VALUES
('Test Campaign 1', 'This is a test campaign', '2022-01-01 00:00:00', '2026-01-31 00:00:00'),
('Test Campaign 2', 'This is a test campaign', '2022-01-01 00:00:00', '2026-01-31 00:00:00'),
('Test Campaign 3', 'This is a test campaign', '2022-01-01 00:00:00', '2022-01-31 00:00:00'),
('Long future campaign', 'This is a test campaign in the long future ', '2026-01-01 00:00:00', '2028-01-31 00:00:00'),
('Test Campaign 5', 'This is a test campaign', '2022-01-01 00:00:00', '2028-01-31 00:00:00'),
('Upcoming future campaign', 'This is an upcoming test campaign (as of Nov 2024)', '2024-11-30 00:00:00', '2024-12-30 00:00:00')",
# Enroll user 3 (ktd cardnumber: 42) to some campaigns
"INSERT INTO ce_user_campaign (userId, campaignId, enrollmentDate) VALUES
(3, 5, '2024-11-06 16:55:26'),
(3, 2, '2024-11-06 16:55:26')",
# Insert milestones
"INSERT INTO ce_milestone (name, conditionalField, conditionalValue, conditionalOperator, milestoneType, campaignId) VALUES
('Test Milestone 1', 'title_display', 'Title', 'equals', 'user_checkout', 1),
('Test Milestone 2', 'author_display', 'Author', 'equals', 'user_hold', 2),
('Test Milestone 3', 'author_display', 'Author', 'equals', 'user_checkout', 2),
('Milestone without condition', 'author_display', '', 'equals', 'user_checkout', 2),
('Test Milestone 5', 'subject_facet', 'Subject', 'equals', 'user_work_review', 3),
('Test Milestone 6', 'user_list', '1', 'equals', 'user_checkout', 3),
('Test Milestone 7', 'user_list', '1', 'equals', 'user_checkout', 5)",
# Link milestones to campaigns
"INSERT INTO ce_campaign_milestones (campaignId, milestoneId, goal, reward) VALUES
(1, 1, 10, -1),
(2, 2, 10, -1),
(2, 3, 10, -1),
(3, 3, 10, -1),
(2, 4, 15, -1),
(3, 4, 10, -1),
(5, 5, 12, -1)",
# Insert rewards
"INSERT INTO ce_reward (name, description, rewardType) VALUES
('Test Reward 1', 'This is a test reward', 0),
('Test Reward 2', 'This is a test reward', 0),
('Test Reward 3', 'This is a test reward', 0)",
# Insert some users milestones progress
"INSERT INTO ce_campaign_milestone_users_progress (userId, ce_milestone_id, progress, rewardGiven) VALUES
(3, 1, 4, 1),
(3, 2, 6, 0),
(3, 3, 3, 1),
(3, 4, 8, 0)",
# Enable the community module
"UPDATE modules SET enabled = 1 WHERE name = 'Community'"
],
],
];
}

0 comments on commit 8059f6c

Please sign in to comment.