print to browser console ; remove magic numbers ; improve tests
This commit is contained in:
@@ -7,3 +7,5 @@ parapet_coefficients = 0.88, 1.2
|
||||
system_force_capacity = 418.
|
||||
|
||||
minimum_racking_capacity = 226
|
||||
|
||||
max_corner_angle = 135
|
||||
@@ -298,11 +298,6 @@ def array_summary():
|
||||
context['inaccurate_drawing_warning'] = 'The subarrays in this design are not parallel to each other, \
|
||||
and the graphical representation on this page may not be accurate.'
|
||||
|
||||
print("=================")
|
||||
print("CORNERS : ")
|
||||
print(context['corners'])
|
||||
print("=================")
|
||||
|
||||
except FileValidationException as error:
|
||||
# when calculator is about to enter infinte loop
|
||||
# it throws an exception - it is supplied wrong data
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import sys
|
||||
from math import sqrt, atan, degrees
|
||||
from helix.models.corner import Corner
|
||||
from helix.constants.global_constants import max_corner_angle
|
||||
|
||||
class ProjectPresenter(object):
|
||||
def __init__(self, system_type, module_type):
|
||||
@@ -85,6 +86,8 @@ class ProjectPresenter(object):
|
||||
else:
|
||||
next_corner = building[i+1]
|
||||
|
||||
#x coordinate is stored as first element of corner variable
|
||||
#y coordinate is stored as second element of corner variable
|
||||
corner_length_ccw = sqrt((next_corner[0] - corner[0])**2 + (next_corner[1] - corner[1])**2)
|
||||
corner_length_cw = sqrt((previous_corner[0] - corner[0])**2 + (previous_corner[1] - corner[1])**2)
|
||||
|
||||
@@ -103,12 +106,11 @@ class ProjectPresenter(object):
|
||||
if (k1 > 0 and k2 > 0):
|
||||
theta1 = 180 + theta1
|
||||
|
||||
if (theta1 < 135):
|
||||
if (theta1 < max_corner_angle):
|
||||
presentable_building.append(Corner(corner[0], corner[1], corner_length_ccw,corner_length_cw, theta1).__dict__)
|
||||
|
||||
previous_corner = corner
|
||||
|
||||
|
||||
return result
|
||||
|
||||
def get_max_y(self,buildings, panels):
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
{% extends "layout.html.jinja" %}
|
||||
{% set title = "Helix Calculator" %}
|
||||
{% block contents %}
|
||||
<script>
|
||||
{%if context['corners']%}
|
||||
var corners_data = {{ context['corners']|tojson}};
|
||||
if (corners_data){
|
||||
console.log("Corners data :");
|
||||
console.log(corners_data);
|
||||
}
|
||||
{%endif%}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var is_csv_available = {{ context['csv_available']|tojson|safe }};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user