refactor: introduce node class
This commit is contained in:
parent
a427029151
commit
d53b34c0ce
@ -1,6 +1,7 @@
|
|||||||
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
|
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
import datetime
|
||||||
from collections import deque
|
from collections import deque
|
||||||
from math import floor
|
from math import floor
|
||||||
|
|
||||||
@ -11,6 +12,36 @@ from frappe.model.document import Document
|
|||||||
from frappe.utils import getdate
|
from frappe.utils import getdate
|
||||||
|
|
||||||
|
|
||||||
|
class Node(object):
|
||||||
|
def __init__(self):
|
||||||
|
self.parent = None
|
||||||
|
self.left_child = None
|
||||||
|
self.right_child = None
|
||||||
|
|
||||||
|
self.current_period = None
|
||||||
|
self.difference = 0.0
|
||||||
|
self.profit_and_loss_summary = 0.0
|
||||||
|
self.balance_sheet_summary = 0.0
|
||||||
|
|
||||||
|
def update_parent(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def update_left_child(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def update_right_child(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_node(
|
||||||
|
self,
|
||||||
|
parent: int = None,
|
||||||
|
period: (datetime, datetime) = None,
|
||||||
|
left: int = None,
|
||||||
|
right: int = None,
|
||||||
|
):
|
||||||
|
current_period = period
|
||||||
|
|
||||||
|
|
||||||
class BisectAccountingStatements(Document):
|
class BisectAccountingStatements(Document):
|
||||||
def bfs(self):
|
def bfs(self):
|
||||||
period_list = deque([(getdate(self.from_date), getdate(self.to_date))])
|
period_list = deque([(getdate(self.from_date), getdate(self.to_date))])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user