mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
See #5940. Fix bug where ODS and XLSX didn't correctly check for whether summaries existed and sometimes printed out "None" rows
This commit is contained in:
@@ -296,12 +296,12 @@ class IfcCsv:
|
|||||||
writer.writerow(self.headers)
|
writer.writerow(self.headers)
|
||||||
for row in self.results:
|
for row in self.results:
|
||||||
writer.writerow(row)
|
writer.writerow(row)
|
||||||
if any([s for s in self.summaries if s is not None]):
|
if self.has_summaries():
|
||||||
writer.writerow(self.summaries)
|
writer.writerow(self.summaries)
|
||||||
|
|
||||||
def export_ods(self, output, should_preserve_existing=False):
|
def export_ods(self, output, should_preserve_existing=False):
|
||||||
df = self.export_pd()
|
df = self.export_pd()
|
||||||
if self.summaries:
|
if self.has_summaries():
|
||||||
df.loc[df.shape[0]] = self.summaries
|
df.loc[df.shape[0]] = self.summaries
|
||||||
|
|
||||||
if os.path.exists(output) and should_preserve_existing:
|
if os.path.exists(output) and should_preserve_existing:
|
||||||
@@ -362,9 +362,12 @@ class IfcCsv:
|
|||||||
row.addElement(new_cell)
|
row.addElement(new_cell)
|
||||||
return new_cell
|
return new_cell
|
||||||
|
|
||||||
|
def has_summaries(self):
|
||||||
|
return any([s for s in self.summaries if s is not None])
|
||||||
|
|
||||||
def export_xlsx(self, output, should_preserve_existing=False):
|
def export_xlsx(self, output, should_preserve_existing=False):
|
||||||
df = self.export_pd()
|
df = self.export_pd()
|
||||||
if self.summaries:
|
if self.has_summaries():
|
||||||
df.loc[df.shape[0]] = self.summaries
|
df.loc[df.shape[0]] = self.summaries
|
||||||
|
|
||||||
if os.path.exists(output):
|
if os.path.exists(output):
|
||||||
|
|||||||
Reference in New Issue
Block a user