This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compute giving and receiving amounts more accurately
fixes #1127
- Loading branch information
Showing
7 changed files
with
104 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,26 @@ | ||
BEGIN; | ||
DROP VIEW goal_summary; | ||
ALTER TABLE tips ADD COLUMN is_funded boolean; | ||
|
||
-- Needs to be recreated to include the new column | ||
DROP VIEW current_tips; | ||
CREATE VIEW current_tips AS | ||
SELECT DISTINCT ON (tipper, tippee) * | ||
FROM tips | ||
ORDER BY tipper, tippee, mtime DESC; | ||
|
||
-- Allow updating is_funding via the current_tips view for convenience | ||
CREATE FUNCTION update_tip() RETURNS trigger AS $$ | ||
BEGIN | ||
UPDATE tips | ||
SET is_funded = NEW.is_funded | ||
WHERE id = NEW.id; | ||
RETURN NULL; | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
|
||
CREATE TRIGGER update_current_tip INSTEAD OF UPDATE ON current_tips | ||
FOR EACH ROW EXECUTE PROCEDURE update_tip(); | ||
|
||
\i fake_payday.sql | ||
END; |
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
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