Add ip address to csv

This commit is contained in:
James Grugett 2022-09-03 23:52:33 -05:00
parent b8b2778b69
commit 3b390f758f

View File

@ -56,18 +56,20 @@ function UsersTable() {
return { return {
email: privateUsersById[user.id]?.email, email: privateUsersById[user.id]?.email,
profit: profitByUser[user.id] ?? 0, profit: profitByUser[user.id] ?? 0,
ip: privateUsersById[user.id]?.initialIpAddress,
...user, ...user,
} }
}) })
.sort((a, b) => b.createdTime - a.createdTime) .sort((a, b) => b.createdTime - a.createdTime)
function exportCsv() { function exportCsv() {
const lines = [['Email', 'Name', 'Balance', 'Profit']].concat( const lines = [['Email', 'Name', 'Balance', 'Profit', 'IP Address']].concat(
fullUsers.map((u) => [ fullUsers.map((u) => [
u.email ?? '', u.email ?? '',
u.name, u.name,
Math.round(u.balance).toString(), Math.round(u.balance).toString(),
Math.round(profitByUser[u.id] ?? 0).toString(), Math.round(profitByUser[u.id] ?? 0).toString(),
u.ip ?? '',
]) ])
) )
const csv = lines.map((line) => line.join(', ')).join('\n') const csv = lines.map((line) => line.join(', ')).join('\n')