Skip to content
This repository has been archived by the owner on Jan 10, 2020. It is now read-only.

Commit

Permalink
fix promotions pulling correct timing
Browse files Browse the repository at this point in the history
  • Loading branch information
James Baxley committed Jul 23, 2016
1 parent fa19fc7 commit 7ed4e49
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/expression-engine/models/content/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,22 @@ export class Content extends EE {
attributes: ["entry_id", "channel_id", "site_id"].concat(fields as any[]), // why typescript
include: [
{ model: Channels.model},
{ model: ChannelTitles.model },
{
model: ChannelTitles.model,
where: {
entry_date: { $lte: Sequelize.literal("UNIX_TIMESTAMP(NOW())") },
expiration_date: {
$or: [
{ $eq: 0 },
{ $gt: Sequelize.literal("UNIX_TIMESTAMP(NOW())") },
],
},
},
},
],
})
.then(x => {
if (!x.exp_channel) return null;
x.exp_channel.exp_channel_fields = exp_channel_fields;
return x;
})
Expand Down Expand Up @@ -145,6 +157,7 @@ export class Content extends EE {
.then(x => x.sort_order.split("|"))
.then(x => x.filter(y => !!y).map(z => ({ entry_id: z }))) // used so the next line can work
.then(this.getFromIds.bind(this))
.then(x => x.filter(y => !!y))
, { ttl: 3600 }); // expire this lookup every hour
}

Expand Down
1 change: 1 addition & 0 deletions src/expression-engine/models/content/tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const channelTitleSchema: Object = {
day: { type: CHAR },
month: { type: CHAR },
entry_date: { type: INTEGER },
expiration_date: { type: INTEGER },
};

const channelDataSchema: Object = {
Expand Down

0 comments on commit 7ed4e49

Please sign in to comment.