Skip to content

Instantly share code, notes, and snippets.

@roylee0704
Created February 17, 2017 10:42
Show Gist options
  • Save roylee0704/e98abfa520fea40d9d1def63a0cd0dd7 to your computer and use it in GitHub Desktop.
Save roylee0704/e98abfa520fea40d9d1def63a0cd0dd7 to your computer and use it in GitHub Desktop.
path incentive
INSERT INTO `gb_m_incentive_program` (`name`, `allow_multiple_per_cycle`, `priority`, `amount`, `criteria`, `created_at`, `updated_at`, `is_deleted`, `is_active`, `currency`, `iteration`, `cycle`, `duration`, `execution_count`, `current_iteration`, `current_cycle`, `starts_at`, `expires_at`, `next_run`, `prev_run`, `is_running`, `timezone`, `bonus`, `duration_unit`)
VALUES
(9, 'Incentive Milestone (Round 2)', 0, 1, 0.00, '{\"conditions\":[{\"table\":\"gb_m_task AS t\",\"columns\":[\"t.sp_id\"],\"count\":\"t.task_id AS score\",\"joinRaw\":[{\"value\":\"INNER JOIN gb_m_sp s ON s.sp_id = t.sp_id\"}],\"where\":[{\"column\":\"stage\",\"op\":\"=\",\"value\":\"6\"},{\"column\":\"overall_status\",\"op\":\"=\",\"value\":\"100\"},{\"column\":\"t.sp_id\",\"op\":\"is not\",\"value\":null},{\"column\":\"t.created_at\",\"op\":\">=\",\"var\":\"scandate_lower_bound\"},{\"column\":\"s.sp_type\",\"op\":\"=\",\"value\":0},{\"column\":\"t.created_at\",\"op\":\"<\",\"var\":\"scandate_upper_bound\"}],\"groupBy\":\"t.sp_id\",\"having\":{\"column\":\"score\",\"op\":\">=\",\"value\":\"5\"}}],\"limit\":1000}', '2017-02-06 00:00:00', '2017-02-16 08:33:30', 0, 1, 'thb', 1, 4, 7, 1, 1, 1, '2017-02-06 00:00:00', '2017-04-30 00:00:00', '2017-02-20 00:00:00', '2017-02-16 15:33:30', 0, 7, '{\"formulas\":[{\"description\":\"incentive by scores\",\"ifs\":[{\"lOperand\":\"score\",\"op\":\">=\",\"rOperand\":16,\"ret\":300},{\"ret\":0}]},{\"description\":\"incentive by streaks\",\"ifs\":[{\"lOperand\":\"streak\",\"op\":\">=\",\"rOperand\":3,\"ret\":400},{\"lOperand\":\"streak\",\"op\":\">=\",\"rOperand\":2,\"ret\":300},{\"lOperand\":\"streak\",\"op\":\">=\",\"rOperand\":1,\"ret\":200},{\"lOperand\":\"streak\",\"op\":\"==\",\"rOperand\":0,\"ret\":150},{\"ret\":0}]}]}', 'DAYS');
INSERT INTO `gb_n_milestone` (`id`, `incentive_program_id`, `sp_id`, `iteration`, `cycle`, `completed_job`, `incentive`, `currency`, `start_date`, `end_date`, `created_at`, `updated_at`, `streak`, `worked_day`, `acceptance_rate`, `completion_rate`)
VALUES
(33, 9, 1001487, 1, 1, 11, 150.00, 'thb', '2017-02-05 17:00:00', '2017-02-12 17:00:00', '2017-02-16 08:33:28', '2017-02-16 08:33:28', 0, 0, NULL, NULL),
(34, 9, 1041549, 1, 1, 7, 150.00, 'thb', '2017-02-05 17:00:00', '2017-02-12 17:00:00', '2017-02-16 08:33:28', '2017-02-16 08:33:28', 0, 0, NULL, NULL),
(35, 9, 1041575, 1, 1, 6, 150.00, 'thb', '2017-02-05 17:00:00', '2017-02-12 17:00:00', '2017-02-16 08:33:28', '2017-02-16 08:33:28', 0, 0, NULL, NULL),
(36, 9, 1041584, 1, 1, 6, 150.00, 'thb', '2017-02-05 17:00:00', '2017-02-12 17:00:00', '2017-02-16 08:33:28', '2017-02-16 08:33:28', 0, 0, NULL, NULL),
(37, 9, 1041609, 1, 1, 6, 150.00, 'thb', '2017-02-05 17:00:00', '2017-02-12 17:00:00', '2017-02-16 08:33:29', '2017-02-16 08:33:29', 0, 0, NULL, NULL),
(38, 9, 1042035, 1, 1, 9, 150.00, 'thb', '2017-02-05 17:00:00', '2017-02-12 17:00:00', '2017-02-16 08:33:29', '2017-02-16 08:33:29', 0, 0, NULL, NULL),
(39, 9, 1042793, 1, 1, 6, 150.00, 'thb', '2017-02-05 17:00:00', '2017-02-12 17:00:00', '2017-02-16 08:33:29', '2017-02-16 08:33:29', 0, 0, NULL, NULL),
(40, 9, 1042912, 1, 1, 22, 450.00, 'thb', '2017-02-05 17:00:00', '2017-02-12 17:00:00', '2017-02-16 08:33:29', '2017-02-16 08:33:29', 0, 0, NULL, NULL),
(41, 9, 1044875, 1, 1, 5, 150.00, 'thb', '2017-02-05 17:00:00', '2017-02-12 17:00:00', '2017-02-16 08:33:29', '2017-02-16 08:33:29', 0, 0, NULL, NULL);
INSERT INTO `gb_n_incentive` (`id`, `sp_id`, `incentive_program_id`, `term_weeks`, `created_at`, `updated_at`, `start_date`, `end_date`, `amount`, `currency`)
VALUES
(78, 1001487, 9, 1, '2017-02-16 08:33:30', '2017-02-16 08:33:30', '2017-02-05', '2017-02-12', 150.00, 'thb'),
(79, 1041549, 9, 1, '2017-02-16 08:33:30', '2017-02-16 08:33:30', '2017-02-05', '2017-02-12', 150.00, 'thb'),
(80, 1041575, 9, 1, '2017-02-16 08:33:30', '2017-02-16 08:33:30', '2017-02-05', '2017-02-12', 150.00, 'thb'),
(81, 1041584, 9, 1, '2017-02-16 08:33:30', '2017-02-16 08:33:30', '2017-02-05', '2017-02-12', 150.00, 'thb'),
(82, 1041609, 9, 1, '2017-02-16 08:33:30', '2017-02-16 08:33:30', '2017-02-05', '2017-02-12', 150.00, 'thb'),
(83, 1042035, 9, 1, '2017-02-16 08:33:30', '2017-02-16 08:33:30', '2017-02-05', '2017-02-12', 150.00, 'thb'),
(84, 1042793, 9, 1, '2017-02-16 08:33:30', '2017-02-16 08:33:30', '2017-02-05', '2017-02-12', 150.00, 'thb'),
(85, 1042912, 9, 1, '2017-02-16 08:33:30', '2017-02-16 08:33:30', '2017-02-05', '2017-02-12', 450.00, 'thb'),
(86, 1044875, 9, 1, '2017-02-16 08:33:30', '2017-02-16 08:33:30', '2017-02-05', '2017-02-12', 150.00, 'thb');
INSERT INTO `gb_m_transaction` (`sp_id`, `transaction_id`, `amount`, `currency`, `credit_amt`, `payout_amt`, `description`, `status`, `transaction_type`, `reference_id`, `created_at`, `updated_at`, `nonwithdrawable_amt`)
VALUES
(1041584, 10240, 150.00, 'thb', 0.00, 150.00, 'Incentive', 1, 21, 81, '2017-02-16 08:33:30', '2017-02-16 08:33:30', 0.00),
(1041609, 10241, 150.00, 'thb', 0.00, 150.00, 'Incentive', 1, 21, 82, '2017-02-16 08:33:30', '2017-02-16 08:33:30', 0.00),
(1042035, 10242, 150.00, 'thb', 0.00, 150.00, 'Incentive', 1, 21, 83, '2017-02-16 08:33:30', '2017-02-16 08:33:30', 0.00),
(1042793, 10243, 150.00, 'thb', 0.00, 150.00, 'Incentive', 1, 21, 84, '2017-02-16 08:33:30', '2017-02-16 08:33:30', 0.00),
(1042912, 10244, 450.00, 'thb', 0.00, 450.00, 'Incentive', 1, 21, 85, '2017-02-16 08:33:30', '2017-02-16 08:33:30', 0.00),
(1044875, 10245, 150.00, 'thb', 0.00, 150.00, 'Incentive', 1, 21, 86, '2017-02-16 08:33:30', '2017-02-16 08:33:30', 0.00),
(1001487, 10237, 150.00, 'thb', 0.00, 150.00, 'Incentive', 1, 21, 78, '2017-02-16 08:33:30', '2017-02-16 08:33:30', 0.00),
(1041549, 10238, 150.00, 'thb', 0.00, 150.00, 'Incentive', 1, 21, 79, '2017-02-16 08:33:30', '2017-02-16 08:33:30', 0.00),
(1041575, 10239, 150.00, 'thb', 0.00, 150.00, 'Incentive', 1, 21, 80, '2017-02-16 08:33:30', '2017-02-16 08:33:30', 0.00);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment