Created
October 23, 2018 22:55
-
-
Save bad6e/639c6e95addb9a00da515de0d121187e to your computer and use it in GitHub Desktop.
For a given lender, remove all team roles and create new ones
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To Delete Team Roles | |
lender = Lender.find(2327) | |
lender.team_roles.destroy_all | |
# To Create Team Roles, associate team role with existing loan files (if applicable), and set default to true (if applicable) | |
teams = [1368, 1600, 1520, 1154, 1596, 1440, 1442, 1463, 1457, 1374, 1377, 1458, 1583, 1714, 1152, 1475, 1439, 1218, 1593, 1444, 1433, 1507, 1698, 1412, 1397, 1363, 1487, 1361, 1379, 1420, 1454, 1409, 1362, 1465, 1427, 1445, 1485, 1604, 1699, 1506, 1474, 1403, 1586, 1148, 1364, 1434, 1408, 1513, 1150, 1384, 1483, 1484, 1373, 1438, 1149, 1605, 1488, 1548, 1776, 1452, 1503, 1153, 1505, 1429, 1481, 1493, 1517, 1467, 1450, 1468, 1472, 1576, 1636, 1460, 1461, 1549, 980, 1490, 1478, 1432, 1446, 1694, 1151, 1510, 1612, 1219, 1389, 1441, 1508, 1428, 1599, 1217, 1437, 1391, 1500, 1410, 1464, 1497, 1701, 1456, 1386, 1489, 1477, 1371, 1592, 1394, 1502, 1491, 1406, 1390, 1591, 1383, 1376, 1518, 1398, 1511, 1365, 1220, 1606, 1713, 1607, 1215, 1367, 1417, 1515, 1393, 1521, 1421, 1436, 1550, 1501, 1405, 1575, 1431, 1519, 1476, 1424, 1370, 1486, 1414, 1378, 1499, 1459, 1479, 1416, 1462, 1455, 1635, 1658, 1426, 1597, 1399, 1404, 1423, 1419, 1415, 1608, 1471, 1451, 1494, 1609, 1453, 1601, 1388, 1514, 1402, 1447, 1375, 1509, 1610, 1512, 1385, 1473, 1495, 1498, 1425, 1598, 1469, 1504, 1448, 1430, 1381, 1216, 1395, 1775, 1407, 1396, 1573, 1392, 1372, 1422, 1496, 1155, 1449, 1418, 1366, 1401, 1700, 1435, 1382, 1516, 1380, 1492, 1411, 1443, 1466, 1470, 1577, 1400, 1482, 1413, 1611, 1480] | |
teams.each do |team_id| | |
team = Team.find team_id | |
begin | |
::CS::CreateTeamRoleService.new(team: team, lender: lender, role: :manager, associate_existing_loan_files: true, default: true).perform | |
rescue StandardError | |
message = "Unable to add lender id: #{lender.id} to team: #{team.id} as manager" | |
puts message | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment