outline fix
This commit is contained in:
@@ -285,12 +285,11 @@ def array_summary():
|
||||
context['summary_values'] = calculator.summary_values()
|
||||
|
||||
panels = calculator.get_computed_csv_columns()
|
||||
max_y = project_presenter.get_max_y(calculator.buildings_for_drawing,panels)
|
||||
context['panel_array'] = project_presenter.get_panel_data(panels,
|
||||
calculator.subarrays,
|
||||
project_presenter.get_max_y(
|
||||
calculator.buildings_for_drawing,
|
||||
panels))
|
||||
context['buildings'] = project_presenter.get_buildings(calculator.buildings_for_drawing)
|
||||
max_y)
|
||||
context['buildings'] = project_presenter.get_buildings(calculator.buildings_for_drawing, max_y)
|
||||
context['override_form'] = True
|
||||
context['cad_file_name'] = session_manager.site.cad_file_name or 'Upload System Text Data'
|
||||
context['dxf_file_name'] = session_manager.site.dxf_file_name or 'Upload System DXF'
|
||||
|
||||
@@ -50,9 +50,10 @@ class ProjectPresenter(object):
|
||||
self.offset = height
|
||||
for panel in table_data:
|
||||
panel['y'] = height - panel['y'] + first_cell
|
||||
|
||||
return table_data
|
||||
|
||||
def get_buildings(self, buildings):
|
||||
def get_buildings(self, buildings, max_y):
|
||||
if self.offset is None:
|
||||
self.offset = 0
|
||||
|
||||
@@ -67,7 +68,7 @@ class ProjectPresenter(object):
|
||||
# origin = self.find_origin(building)
|
||||
for point in building:
|
||||
point.x = point.x * spacing_x
|
||||
point.y = point.y * spacing_y
|
||||
point.y = abs((point.y * spacing_y - max_y))
|
||||
presentable_building.append(point.__dict__)
|
||||
|
||||
return result
|
||||
|
||||
@@ -66,14 +66,14 @@ class PanelPresenterTest(unittest.TestCase):
|
||||
|
||||
def test_get_buildings_data(self):
|
||||
self.subject = ProjectPresenter(SystemType.singleTilt, ModuleType.Cell96)
|
||||
buildings = [ [ Coordinate(-60,-60), Coordinate(60,-60), Coordinate(60,60), Coordinate(-60,60) ] ] # big square
|
||||
buildings = [ [ Coordinate(0,0), Coordinate(60,0), Coordinate(60,60), Coordinate(0,60) ] ] # big square
|
||||
expected_buildings = [[
|
||||
{'x': -60, '_Coordinate__rounded_x': -60, 'y': -60, '_Coordinate__rounded_y': -60, 'rotation': 0.0},
|
||||
{'x': 60, '_Coordinate__rounded_x': 60, 'y': -60, '_Coordinate__rounded_y': -60, 'rotation': 0.0},
|
||||
{'x': 60, '_Coordinate__rounded_x': 60, 'y': 60, '_Coordinate__rounded_y': 60, 'rotation': 0.0},
|
||||
{'x': -60, '_Coordinate__rounded_x': -60, 'y': 60, '_Coordinate__rounded_y': 60, 'rotation': 0.0}
|
||||
{'x': 0, '_Coordinate__rounded_x': 0, 'y': 60, '_Coordinate__rounded_y': 0, 'rotation': 0.0},
|
||||
{'x': 60, '_Coordinate__rounded_x': 60, 'y': 60, '_Coordinate__rounded_y': 0, 'rotation': 0.0},
|
||||
{'x': 60, '_Coordinate__rounded_x': 60, 'y': 0, '_Coordinate__rounded_y': 60, 'rotation': 0.0},
|
||||
{'x': 0, '_Coordinate__rounded_x': 0, 'y': 0, '_Coordinate__rounded_y': 60, 'rotation': 0.0}
|
||||
]]
|
||||
actual_buildings = self.subject.get_buildings(buildings)
|
||||
actual_buildings = self.subject.get_buildings(buildings,60)
|
||||
assert_array_equal(actual_buildings,expected_buildings)
|
||||
|
||||
def test_get_max_y(self):
|
||||
|
||||
Reference in New Issue
Block a user