Skip to content
Closed
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
2 changes: 1 addition & 1 deletion script.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def update_reason(facility_name, buy_price, sell_price, lowest_buy_price, highes
current_hour = local_time.hour

# Calculate the energy required to reach full charge (in kWh)
remaining_energy_kWh = (100 - battery_soc) / 100 * battery_capacity_kWh
remaining_energy_kWh = (full_battery - battery_soc) / 100 * battery_capacity_kWh

# Calculate the time required to charge the battery to full (in hours)
time_to_full_charge = remaining_energy_kWh / max_charge_rate_kW
Expand Down
6 changes: 3 additions & 3 deletions test_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,16 @@ def test_script(self):
"code": self.content,
"inverter_action_id": 1,
}

response_json = ''

try:
check_code_response = requests.post(powston_api_test_code_endpoint, json=body, headers=self.header)
check_code_response.raise_for_status()

response_json = check_code_response.json()
self.assertEqual(check_code_response.status_code, 200, "Expected status code 200")
self.assertIn('Success', response_json['problems'], "Expected 'Success' in problems")
self.assertTrue(response_json['status'], "Expected status to be True")
self.assertTrue(response_json['status'], f"Expected status to be True: {response_json}")
except requests.RequestException as e:
self.fail(f"Request failed: {str(e)}")
except KeyError as e:
Expand Down
Loading