This file contains hidden or 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
groupsCalculated: (state) => { | |
const buildNetwork = (connection) => ({ service_id: connection.service_id, login_id: connection.login_id }); | |
const connectionWithNetwork = (conn, net) => ({ ...conn, networks: [...conn.networks, buildNetwork(net)] }); | |
const buildConnection = (conn) => ({ name: conn.name, id: conn.id, networks: [] }); | |
return Object.values(state.all.reduce((acc, curr) => (acc[curr.name] ? | |
{ ...acc, [curr.name]: connectionWithNetwork(acc[curr.name], curr) } : | |
{ ...acc, [curr.name]: connectionWithNetwork(buildConnection(curr), curr) } |
This file contains hidden or 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
def build_address_lines(record) | |
lines = [] | |
%w{store_name address1 address2 address3}.each do |field| | |
lines << record[field].strip unless record[field].blank? | |
end | |
last_line = '' | |
%w{city state zip country}.each do |field| | |
last_line << ' ' + record[field].strip unless record[field].blank? | |
end | |
lines << last_line unless last_line.blank? |