Skip to content

Minor refactor steps calculation #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/banners.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .functions import get_location_details
from backend.functions import get_location_details

# Banner
banner = """
Expand All @@ -23,7 +23,7 @@
"""


def print_geo_coordinater(lat, lon):
def print_geo_coordinates(lat, lon):
print("[ * ] Harvesting information based on the next coordinates:")
print("\t[ * * ] Latitude: ", lat)
print("\t[ * * ] Longitude:", lon)
Expand Down
4 changes: 2 additions & 2 deletions backend/combine_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .functions import combine_json_files
from .json_into_html import generate_html_from_json
from backend.functions import combine_json_files
from backend.json_into_html import generate_html_from_json


def combine_data(report_json_directory="./reports-json/", report_html_directory="./reports-html/"):
Expand Down
37 changes: 9 additions & 28 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
print_combined_data,
print_current_step,
print_files_stored,
print_geo_coordinater,
print_geo_coordinates,
print_len_steps,
print_start_harvesting,
print_successfully,
Expand Down Expand Up @@ -77,19 +77,6 @@
pattern = generate_pattern((calculate_length(meters + 400) + 800) // 200) # Adjust the length as needed (x / 2 - 2)
current_datetime = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")

# Store the initial coordinates and initialize lists to store the coordinates for each step
initial_latitude = latitude
initial_longitude = longitude
step_coordinates = []

# Initialize variables to store coordinates and counts
coordinates = []
coordinates_count = 0
coordinates_sum = [0, 0]

# Extract users with distance 500
filtered_users = []

# Initialize an empty dictionary to store user data
users_data = {}
step = 0
Expand All @@ -108,27 +95,21 @@
# Banner logo
print(banner)

# Printing geo cordinates
print_geo_coordinater(latitude, longitude)
# Printing geo coordinates
print_geo_coordinates(latitude, longitude)

# Printing city and country by coordinates
print_city_by_geo(latitude, longitude)

# Perform steps according to the pattern
for i, steps in enumerate(pattern):
if i == 0:
direction = "starting"
elif i % 4 == 1:
direction = "west"
elif i % 4 == 2:
direction = "south"
elif i % 4 == 3:
direction = "east"
else:
direction = "north"
# Calculate steps according to the pattern and store it in the step_coordinates var
directions = ("north", "west", "south", "east")
direction = "starting"
step_coordinates = []
for i, steps in enumerate(pattern, start=1):
for _ in range(steps):
latitude, longitude = calculate_coordinates(latitude, longitude, direction, 0.6) # 600 meters in kilometers
step_coordinates.append((latitude, longitude))
direction = directions[i % 4]

# Print number of steps
print_len_steps(len(step_coordinates), meters)
Expand Down