Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
Fixed wrong calculation of reordered cells
Browse files Browse the repository at this point in the history
  • Loading branch information
Holger Stitz committed Jun 27, 2017
1 parent 2beb1ab commit ce8f0b3
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions taco_server/src/diff_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,29 @@ def reorder_cols_counts(self):
filtered_content = filter(lambda r: r['col'] in ids, self.content)
return float(len(filtered_content))

def reorder_rows_cols_counts(self):
"""
Count only cells with content changes
:param width:
:param height:
:return:
"""
row_ids = map(lambda r: r['id'], self.reorder['rows'])
col_ids = map(lambda r: r['id'], self.reorder['cols'])
filtered_content = filter(lambda r: r['col'] in col_ids and r['row'] in row_ids, self.content)
return float(len(filtered_content))

def reorder_counts(self):
reordered_counts = 0

if "rows" in self.reorder:
reordered_counts += self.reorder_rows_counts()
if "rows" in self.reorder and "cols" in self.reorder:
reordered_counts = self.reorder_rows_cols_counts()

elif "rows" in self.reorder:
reordered_counts = self.reorder_rows_counts()

if "cols" in self.reorder:
reordered_counts += self.reorder_cols_counts()
elif "cols" in self.reorder:
reordered_counts = self.reorder_cols_counts()

return float(reordered_counts)

Expand Down

0 comments on commit ce8f0b3

Please sign in to comment.