Commit e8814323 authored by Philippe Lefebvre's avatar Philippe Lefebvre
Browse files

Update bdd.sql, requests.py, NF18 RENDU FINAL LEFEBVRE GOMMARD PERON.pdf

Deleted NF18_RENDU_FINAL_LEFEBVRE_GOMMARD_PERON.pdf
parent 5478960b
......@@ -166,5 +166,18 @@ RETURNS TRIGGER as $set_dd$
RETURN NEW;
END;
$set_dd$ LANGUAGE plpgsql;
CREATE TRIGGER update_minmax_courant AFTER UPDATE OF solde ON comptescourant FOR EACH ROW EXECUTE FUNCTION set_minmax_courant();
CREATE OR REPLACE FUNCTION appliquer_taux_revolving()
RETURNS TRIGGER as $tr$
DECLARE diff INT;
BEGIN
SELECT DATE_PART('day', current_timestamp - NEW.dernieretransaction) INTO diff;
NEW.solde = NEW.solde * (NEW.tauxjournalier ^ diff);
IF (diff > 0) THEN
NEW.dernieretransaction = current_timestamp;
END IF;
RETURN NEW;
END;
$tr$ LANGUAGE plpgsql;
CREATE TRIGGER taux_revolving BEFORE UPDATE ON comptesrevolving FOR EACH ROW EXECUTE FUNCTION appliquer_taux_revolving();
......@@ -130,13 +130,11 @@ class Requests:
self.utils.writeLogs(e)
return False
def createRevolvingAccount(
self, num: int, solde: int, taux: int, montant: int
) -> bool:
def createRevolvingAccount(self, num: int, solde: int, taux: int, montant: int) -> bool:
id = self.__generateAccountId()
try:
self.cur.execute(
"INSERT INTO comptesrevolving VALUES (%s, current_timestamp, %s,%s,%s,%s)",
"INSERT INTO comptesrevolving VALUES (%s, current_timestamp, %s,%s,%s,%s,current_timestamp)",
(id, self.account_state[0], taux, montant, solde),
)
self.addUserToAccount(num, id, "revolving")
......@@ -145,9 +143,7 @@ class Requests:
self.utils.writeLogs(e)
return False
def createEpargneAccount(
self, num: int, interet: int, plafond: int, solde: int
) -> bool:
def createEpargneAccount(self, num: int, interet: int, plafond: int, solde: int) -> bool:
id = self.__generateAccountId()
try:
self.cur.execute(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment