Styles propagating - testing in prod now
This commit is contained in:
parent
1408f6c44e
commit
7d138d1ee9
|
@ -261,7 +261,7 @@
|
||||||
<p style='display: inline'>
|
<p style='display: inline'>
|
||||||
{{investment_value}}
|
{{investment_value}}
|
||||||
<!-- M$10,000-->
|
<!-- M$10,000-->
|
||||||
<p style='font-size:14px;display: inline; padding: 2px; border-radius: 5px; background-color: rgba(160,0,0,0.2);'>
|
<p style='{{investment_change_style}}'>
|
||||||
{{investment_change}}
|
{{investment_change}}
|
||||||
<!-- +17%-->
|
<!-- +17%-->
|
||||||
</p>
|
</p>
|
||||||
|
@ -317,7 +317,7 @@
|
||||||
<p style='font-size: 24px;display: inline'>
|
<p style='font-size: 24px;display: inline'>
|
||||||
{{question1Prob}}
|
{{question1Prob}}
|
||||||
<!-- 99.9%-->
|
<!-- 99.9%-->
|
||||||
<p style='font-size:14px;display: inline; padding: 2px; border-radius: 5px; background-color: rgba(160,0,0,0.2);'>
|
<p style='{{question1ChangeStyle}}'>
|
||||||
{{question1Change}}
|
{{question1Change}}
|
||||||
<!-- +17%-->
|
<!-- +17%-->
|
||||||
</p>
|
</p>
|
||||||
|
@ -335,7 +335,7 @@
|
||||||
<p style='font-size: 24px;display: inline'>
|
<p style='font-size: 24px;display: inline'>
|
||||||
{{question2Prob}}
|
{{question2Prob}}
|
||||||
<!-- 99.9%-->
|
<!-- 99.9%-->
|
||||||
<p style='font-size:14px;display: inline; padding: 2px; border-radius: 5px; background-color: rgba(160,0,0,0.2);'>
|
<p style='{{question2ChangeStyle}}'>
|
||||||
{{question2Change}}
|
{{question2Change}}
|
||||||
<!-- +17%-->
|
<!-- +17%-->
|
||||||
</p>
|
</p>
|
||||||
|
@ -353,7 +353,7 @@
|
||||||
<p style='font-size: 24px;display: inline'>
|
<p style='font-size: 24px;display: inline'>
|
||||||
{{question3Prob}}
|
{{question3Prob}}
|
||||||
<!-- 99.9%-->
|
<!-- 99.9%-->
|
||||||
<p style='font-size:14px;display: inline; padding: 2px; border-radius: 5px; background-color: rgba(160,0,0,0.2);'>
|
<p style='{{question3ChangeStyle}}'>
|
||||||
{{question3Change}}
|
{{question3Change}}
|
||||||
<!-- +17%-->
|
<!-- +17%-->
|
||||||
</p>
|
</p>
|
||||||
|
@ -371,7 +371,7 @@
|
||||||
<p style='font-size: 24px;display: inline'>
|
<p style='font-size: 24px;display: inline'>
|
||||||
{{question4Prob}}
|
{{question4Prob}}
|
||||||
<!-- 99.9%-->
|
<!-- 99.9%-->
|
||||||
<p style='font-size:14px;display: inline; padding: 2px; border-radius: 5px; background-color: rgba(160,0,0,0.2);'>
|
<p style='{{question4ChangeStyle}}'>
|
||||||
{{question4Change}}
|
{{question4Change}}
|
||||||
<!-- +17%-->
|
<!-- +17%-->
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -23,7 +23,7 @@ import {
|
||||||
import {
|
import {
|
||||||
PerContractInvestmentsData,
|
PerContractInvestmentsData,
|
||||||
OverallPerformanceData,
|
OverallPerformanceData,
|
||||||
} from './weekly-profit-loss-emails'
|
} from 'functions/src/weekly-portfolio-emails'
|
||||||
|
|
||||||
export const sendMarketResolutionEmail = async (
|
export const sendMarketResolutionEmail = async (
|
||||||
reason: notification_reason_types,
|
reason: notification_reason_types,
|
||||||
|
@ -642,6 +642,7 @@ export const sendWeeklyPortfolioUpdateEmail = async (
|
||||||
templateData[`question${i + 1}Url`] = investment.questionUrl
|
templateData[`question${i + 1}Url`] = investment.questionUrl
|
||||||
templateData[`question${i + 1}Prob`] = investment.questionProb
|
templateData[`question${i + 1}Prob`] = investment.questionProb
|
||||||
templateData[`question${i + 1}Change`] = investment.questionChange
|
templateData[`question${i + 1}Change`] = investment.questionChange
|
||||||
|
templateData[`question${i + 1}ChangeStyle`] = investment.questionChangeStyle
|
||||||
})
|
})
|
||||||
|
|
||||||
await sendTemplateEmail(
|
await sendTemplateEmail(
|
||||||
|
|
|
@ -30,7 +30,7 @@ export * from './reset-betting-streaks'
|
||||||
export * from './reset-weekly-emails-flag'
|
export * from './reset-weekly-emails-flag'
|
||||||
export * from './on-update-contract-follow'
|
export * from './on-update-contract-follow'
|
||||||
export * from './on-update-like'
|
export * from './on-update-like'
|
||||||
export * from './weekly-profit-loss-emails'
|
export * from './weekly-portfolio-emails'
|
||||||
|
|
||||||
// v2
|
// v2
|
||||||
export * from './health'
|
export * from './health'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { APIError, newEndpoint } from './api'
|
import { APIError, newEndpoint } from './api'
|
||||||
import { sendPortfolioUpdateEmailsToAllUsers } from './weekly-profit-loss-emails'
|
import { sendPortfolioUpdateEmailsToAllUsers } from './weekly-portfolio-emails'
|
||||||
import { isProd } from './utils'
|
import { isProd } from './utils'
|
||||||
|
|
||||||
export const testscheduledfunction = newEndpoint(
|
export const testscheduledfunction = newEndpoint(
|
||||||
|
|
|
@ -3,7 +3,6 @@ import * as admin from 'firebase-admin'
|
||||||
|
|
||||||
import { Contract, CPMMContract } from '../../common/contract'
|
import { Contract, CPMMContract } from '../../common/contract'
|
||||||
import {
|
import {
|
||||||
getAllPrivateUsers,
|
|
||||||
getPrivateUser,
|
getPrivateUser,
|
||||||
getUser,
|
getUser,
|
||||||
getValue,
|
getValue,
|
||||||
|
@ -36,7 +35,8 @@ const firestore = admin.firestore()
|
||||||
|
|
||||||
export async function sendPortfolioUpdateEmailsToAllUsers() {
|
export async function sendPortfolioUpdateEmailsToAllUsers() {
|
||||||
const privateUsers = isProd()
|
const privateUsers = isProd()
|
||||||
? await getAllPrivateUsers()
|
? // ? await getAllPrivateUsers()
|
||||||
|
filterDefined([await getPrivateUser('AJwLWoo3xue32XIiAVrL5SyR1WB2')])
|
||||||
: filterDefined([await getPrivateUser('6hHpzvRG0pMq8PNJs7RZj2qlZGn2')])
|
: filterDefined([await getPrivateUser('6hHpzvRG0pMq8PNJs7RZj2qlZGn2')])
|
||||||
// get all users that haven't unsubscribed from weekly emails
|
// get all users that haven't unsubscribed from weekly emails
|
||||||
const privateUsersToSendEmailsTo = privateUsers
|
const privateUsersToSendEmailsTo = privateUsers
|
||||||
|
@ -152,15 +152,15 @@ export async function sendPortfolioUpdateEmailsToAllUsers() {
|
||||||
log('No portfolio metrics a week ago for user', privateUser.id)
|
log('No portfolio metrics a week ago for user', privateUser.id)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const valueChange =
|
||||||
|
mostRecentPortfolioMetrics.investmentValue -
|
||||||
|
portfolioMetricsAWeekAgo.investmentValue
|
||||||
// get the difference
|
// get the difference
|
||||||
const performanceData = {
|
const performanceData = {
|
||||||
investment_value: formatMoney(
|
investment_value: formatMoney(
|
||||||
mostRecentPortfolioMetrics.investmentValue
|
mostRecentPortfolioMetrics.investmentValue
|
||||||
),
|
),
|
||||||
investment_change: formatMoney(
|
investment_change: formatMoney(valueChange),
|
||||||
portfolioMetricsAWeekAgo.investmentValue -
|
|
||||||
mostRecentPortfolioMetrics.investmentValue
|
|
||||||
),
|
|
||||||
current_balance: formatMoney(user.balance),
|
current_balance: formatMoney(user.balance),
|
||||||
markets_created:
|
markets_created:
|
||||||
usersToContractsCreated[privateUser.id].length.toString(),
|
usersToContractsCreated[privateUser.id].length.toString(),
|
||||||
|
@ -174,6 +174,9 @@ export async function sendPortfolioUpdateEmailsToAllUsers() {
|
||||||
unique_bettors: usersToTxnsReceived[privateUser.id]
|
unique_bettors: usersToTxnsReceived[privateUser.id]
|
||||||
.filter((txn) => txn.category === 'UNIQUE_BETTOR_BONUS')
|
.filter((txn) => txn.category === 'UNIQUE_BETTOR_BONUS')
|
||||||
.length.toString(),
|
.length.toString(),
|
||||||
|
investment_change_style: `font-size:14px;display: inline; padding: 2px; border-radius: 5px; background-color: ${
|
||||||
|
valueChange > 0 ? 'rgba(0,160,0,0.2)' : 'rgba(160,0,0,0.2)'
|
||||||
|
};`,
|
||||||
// More options: bonuses, tips given,
|
// More options: bonuses, tips given,
|
||||||
} as OverallPerformanceData
|
} as OverallPerformanceData
|
||||||
type investmentDiff = {
|
type investmentDiff = {
|
||||||
|
@ -219,6 +222,11 @@ export async function sendPortfolioUpdateEmailsToAllUsers() {
|
||||||
Math.round(
|
Math.round(
|
||||||
(currentMarketProbability - marketProbabilityAWeekAgo) * 100
|
(currentMarketProbability - marketProbabilityAWeekAgo) * 100
|
||||||
) + '%',
|
) + '%',
|
||||||
|
questionChangeStyle: `font-size:14px;display: inline; padding: 2px; border-radius: 5px; background-color: ${
|
||||||
|
currentMarketProbability > marketProbabilityAWeekAgo
|
||||||
|
? 'rgba(0,160,0,0.2)'
|
||||||
|
: 'rgba(160,0,0,0.2)'
|
||||||
|
};`,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
@ -265,8 +273,10 @@ export type PerContractInvestmentsData = {
|
||||||
questionUrl: string
|
questionUrl: string
|
||||||
questionProb: string
|
questionProb: string
|
||||||
questionChange: string
|
questionChange: string
|
||||||
|
questionChangeStyle: string
|
||||||
}
|
}
|
||||||
export type OverallPerformanceData = {
|
export type OverallPerformanceData = {
|
||||||
|
investment_change_style: string
|
||||||
investment_value: string
|
investment_value: string
|
||||||
investment_change: string
|
investment_change: string
|
||||||
current_balance: string
|
current_balance: string
|
Loading…
Reference in New Issue
Block a user