-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make invitations to interesting camps optional
Issue: #3478
- Loading branch information
Showing
6 changed files
with
46 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,46 +48,47 @@ EOF | |
psql $DATABASE_URL < $sql_file_for_restore | ||
|
||
|
||
|
||
cat << 'EOF' | psql $DATABASE_URL | ||
CREATE EXTENSION IF NOT EXISTS pgcrypto; | ||
INSERT INTO camp_collaboration (id, status, role, createtime, | ||
updatetime, userid, campid) | ||
(WITH interesting_camps as ((SELECT c.id | ||
FROM camp c | ||
JOIN activity a on c.id = a.campid | ||
GROUP BY c.id, c.title | ||
ORDER BY count(a.id) DESC | ||
LIMIT 10) | ||
UNION | ||
(SELECT id | ||
FROM ((SELECT c.id | ||
FROM camp c | ||
JOIN activity a on c.id = a.campid | ||
GROUP BY c.id, c.title | ||
ORDER BY count(a.id) DESC) | ||
INTERSECT | ||
(SELECT c.id | ||
FROM camp c | ||
JOIN period p on c.id = p.campid | ||
WHERE p."end" >= now())) as a | ||
LIMIT 10)) | ||
SELECT encode(gen_random_bytes(6), 'hex'), | ||
'established', | ||
'manager', | ||
now(), | ||
now(), | ||
u.id, | ||
ic.id | ||
FROM interesting_camps ic, | ||
profile p | ||
JOIN "user" u ON p.id = u.profileid | ||
WHERE p.email IN ( | ||
'[email protected]' | ||
) | ||
AND ic.id NOT IN (SELECT campid FROM camp_collaboration WHERE userid = u.id)); | ||
if [ "$INVITE_SUPPORT_ACCOUNT_TO_INTERESTING_CAMPS" = "true" ]; then | ||
cat << 'EOF' | psql $DATABASE_URL | ||
CREATE EXTENSION IF NOT EXISTS pgcrypto; | ||
INSERT INTO camp_collaboration (id, status, role, createtime, | ||
updatetime, userid, campid) | ||
(WITH interesting_camps as ((SELECT c.id | ||
FROM camp c | ||
JOIN activity a on c.id = a.campid | ||
GROUP BY c.id, c.title | ||
ORDER BY count(a.id) DESC | ||
LIMIT 10) | ||
UNION | ||
(SELECT id | ||
FROM ((SELECT c.id | ||
FROM camp c | ||
JOIN activity a on c.id = a.campid | ||
GROUP BY c.id, c.title | ||
ORDER BY count(a.id) DESC) | ||
INTERSECT | ||
(SELECT c.id | ||
FROM camp c | ||
JOIN period p on c.id = p.campid | ||
WHERE p."end" >= now())) as a | ||
LIMIT 10)) | ||
SELECT encode(gen_random_bytes(6), 'hex'), | ||
'established', | ||
'manager', | ||
now(), | ||
now(), | ||
u.id, | ||
ic.id | ||
FROM interesting_camps ic, | ||
profile p | ||
JOIN "user" u ON p.id = u.profileid | ||
WHERE p.email IN ( | ||
'[email protected]' | ||
) | ||
AND ic.id NOT IN (SELECT campid FROM camp_collaboration WHERE userid = u.id)); | ||
EOF | ||
fi | ||
|
||
rm -rf $working_dir/* | ||
rm -rf $complete_marker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters