Skip to content

Commit 73bd991

Browse files
committed
Revert "just return true for now"
This reverts commit 6c5044f.
1 parent 6c5044f commit 73bd991

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/server/api/organization.js

+13-14
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,20 @@ export const resolvers = {
5252
}
5353
},
5454
textsAvailable: async (organization) => {
55-
// const mainQuery = `
56-
// select campaign_id
57-
// from campaign_contact
58-
// join campaign on campaign_contact.campaign_id = campaign.id
59-
// where assignment_id is null
60-
// and campaign.is_started = true and campaign.is_archived = false
61-
// and campaign.texting_hours_end > hour(CONVERT_TZ(UTC_TIMESTAMP(), 'UTC', campaign.timezone)) + 1
62-
// group by campaign_contact.campaign_id
63-
// order by campaign.id
64-
// limit 1;
65-
// `
55+
const mainQuery = `
56+
select campaign_id
57+
from campaign_contact
58+
join campaign on campaign_contact.campaign_id = campaign.id
59+
where assignment_id is null
60+
and campaign.is_started = true and campaign.is_archived = false
61+
and campaign.texting_hours_end > hour(CONVERT_TZ(UTC_TIMESTAMP(), 'UTC', campaign.timezone)) + 1
62+
group by campaign_contact.campaign_id
63+
order by campaign.id
64+
limit 1;
65+
`
6666

67-
// const result = await r.knex.raw(mainQuery)
68-
// return result[0].length > 0;
69-
return true
67+
const result = await r.knex.raw(mainQuery)
68+
return result[0].length > 0;
7069
}
7170
}
7271
}

0 commit comments

Comments
 (0)