MCPcopy Index your code
hub / github.com/codecombat/codecombat / shouldSeePromotion

Method shouldSeePromotion

app/models/User.js:845–865  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

843 }
844
845 shouldSeePromotion (key) {
846 const manualPromotionKeys = ['end-of-trial-promotion-modal']
847 if (!key) {
848 return true
849 }
850
851 if (manualPromotionKeys.includes(key)) {
852 return this.shouldSeeManualPromotion(key)
853 }
854
855 const seenPromotion = this.getSeenPromotion(key)
856 if (seenPromotion) {
857 return false
858 }
859 const latestDate = Object.values(this.get('seenPromotions') || {})
860 .reduce((a, b) => new Date(a) > new Date(b) ? new Date(a) : new Date(b), new Date(0))
861
862 const aWeekAgo = new Date()
863 aWeekAgo.setDate(aWeekAgo.getDate() - 7)
864 return latestDate < aWeekAgo
865 }
866
867 setSeenPromotion (key) {
868 const seenPromotions = this.get('seenPromotions') || {}

Callers 2

User.spec.jsFile · 0.80
modals.jsFile · 0.80

Calls 3

getSeenPromotionMethod · 0.95
getMethod · 0.95

Tested by

no test coverage detected