Compare commits
2 Commits
b6e4f97668
...
f42344497e
Author | SHA1 | Date | |
---|---|---|---|
|
f42344497e | ||
|
6dedda577b |
@ -0,0 +1,23 @@
|
||||
CREATE OR REPLACE FUNCTION user_auto_withdraw() RETURNS TRIGGER AS $$
|
||||
DECLARE
|
||||
BEGIN
|
||||
INSERT INTO pgboss.job (name, data)
|
||||
SELECT 'autoWithdraw', jsonb_build_object('id', NEW.id)
|
||||
-- only if there isn't already a pending job for this user
|
||||
WHERE NOT EXISTS (
|
||||
SELECT *
|
||||
FROM pgboss.job
|
||||
WHERE name = 'autoWithdraw'
|
||||
AND data->>'id' = NEW.id::TEXT
|
||||
AND state = 'created'
|
||||
)
|
||||
-- and they have an attached wallet (currently all are received only)
|
||||
AND EXISTS (
|
||||
SELECT *
|
||||
FROM "Wallet"
|
||||
WHERE "userId" = NEW.id
|
||||
AND enabled = TRUE
|
||||
);
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
@ -92,7 +92,7 @@ async function bountyWinner (q) {
|
||||
|
||||
const bounty = await client.query({
|
||||
query: SEARCH,
|
||||
variables: { q: `${q} @sn`, sort: 'recent', what: 'posts', when: 'week' }
|
||||
variables: { q: `${q} @grayruby`, sort: 'recent', what: 'posts', when: 'week' }
|
||||
})
|
||||
|
||||
const items = bounty.data.search.items.filter(i => i.bountyPaidTo?.length > 0)
|
||||
@ -132,7 +132,7 @@ async function getTopUsers ({ by, cowboys = false, includeHidden = false, count
|
||||
variables
|
||||
})
|
||||
cursor = result.data[cowboys ? 'topCowboys' : 'topUsers'].cursor
|
||||
accum.push(...result.data[cowboys ? 'topCowboys' : 'topUsers'].users.filter(user => includeHidden ? true : !!user))
|
||||
accum.push(...result.data[cowboys ? 'topCowboys' : 'topUsers'].users.filter(user => includeHidden ? true : !!user).filter(user => user.name !== 'k00b'))
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@ -158,10 +158,10 @@ async function main () {
|
||||
variables: { sub: 'jobs' }
|
||||
})
|
||||
|
||||
const thisDay = await client.query({
|
||||
query: SEARCH,
|
||||
variables: { q: 'This Day in Stacker News @Undisciplined', sort: 'recent', what: 'posts', when: 'week' }
|
||||
})
|
||||
// const thisDay = await client.query({
|
||||
// query: SEARCH,
|
||||
// variables: { q: 'This Day in Stacker News @Undisciplined', sort: 'recent', what: 'posts', when: 'week' }
|
||||
// })
|
||||
|
||||
const topMeme = await bountyWinner('meme monday')
|
||||
const topFact = await bountyWinner('fun fact')
|
||||
@ -176,7 +176,7 @@ async function main () {
|
||||
Have a great weekend!
|
||||
|
||||
##### Top Posts
|
||||
${top.data.items.items.slice(0, 10).map((item, i) =>
|
||||
${top.data.items.items.map((item, i) =>
|
||||
`${i + 1}. [${item.title}](https://stacker.news/items/${item.id})
|
||||
- ${abbrNum(item.sats)} sats${item.boost ? ` \\ ${abbrNum(item.boost)} boost` : ''} \\ ${item.ncomments} comments \\ [@${item.user.name}](https://stacker.news/${item.user.name})\n`).join('')}
|
||||
|
||||
@ -192,13 +192,6 @@ ${top.data.items.items.map((item, i) =>
|
||||
${meta.data.items.items.slice(0, 10).map((item, i) =>
|
||||
`- [${item.title}](https://stacker.news/items/${item.id})\n`).join('')}
|
||||
|
||||
##### This day in Stacker News
|
||||
|
||||
*a series by [@Undisciplined](https://stacker.news/Undisciplined)*
|
||||
|
||||
${[...thisDay.data.search.items].reverse().map((item, i) =>
|
||||
`- [${item.title}](https://stacker.news/items/${item.id})\n`).join('')}
|
||||
|
||||
[**all meta**](https://stacker.news/~meta/top/posts/week)
|
||||
|
||||
-------
|
||||
|
Loading…
x
Reference in New Issue
Block a user