Skip to content

Commit

Permalink
fix: add dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
m4dm4rtig4n committed Jan 29, 2024
1 parent b3bda75 commit 7becf9e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,20 @@ enable_debug:
disable_debug:
sed -i "s/DEBUG=.*/DEBUG=false/g" .env

## Enable debug mode
enable_dev:
sed -i "s/DEV=.*/DEV=true/g" .env

## Disable debug mode
disable_dev:
sed -i "s/DEV=.*/DEV=false/g" .env

## Run in local
run: init disable_debug bootstrap

## Run local dev (without debug)
dev: init disable_debug enable_dev up bootstrap

## Run in local in debug
debug: init enable_debug up bootstrap down

Expand Down
3 changes: 2 additions & 1 deletion env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
APPLICATION_PATH=src/
APPLICATION_PATH_DATA=data/cache/
APPLICATION_PATH_LOG=data/log
DEBUG=false
DEBUG=false
DEV=true
2 changes: 1 addition & 1 deletion src/models/export_mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def detail_annual(self, price_hp, price_hc=0, measurement_direction="consumption
)

if year == int(datetime.now().strftime("%Y")):
sub_prefix = f"{self.usage_point_id}/{measurement_direction}/annual/current"
sub_prefix = f"{self.usage_point_id}/{measurement_direction}/annual/current"
else:
sub_prefix = f"{self.usage_point_id}/{measurement_direction}/annual/{year}"
mqtt_data = {
Expand Down
6 changes: 3 additions & 3 deletions src/models/export_mqttv1.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ def daily_annual(self, price):
date_begin_current = datetime.combine(date_end.replace(month=1).replace(day=1), datetime.min.time())
finish = False
while not finish:
if date_begin_current.strftime('%Y') == datetime.now().strftime("%Y"):
if date_begin_current.strftime("%Y") == datetime.now().strftime("%Y"):
sub_prefix = f"{self.usage_point_id}/{self.measurement_direction}/annual/current"
else:
else:
sub_prefix = f"{self.usage_point_id}/{self.measurement_direction}/annual/{date_begin_current.strftime('%Y')}"
self.load_daily_data(date_begin_current, date_end, price, sub_prefix)
# CALCUL NEW DATE
Expand Down Expand Up @@ -392,7 +392,7 @@ def detail_annual(self, price_hp, price_hc=0):
date_begin_current = datetime.combine(date_end.replace(month=1).replace(day=1), datetime.min.time())
finish = False
while not finish:
if date_begin_current.strftime('%Y') == datetime.now().strftime("%Y"):
if date_begin_current.strftime("%Y") == datetime.now().strftime("%Y"):
sub_prefix = f"{self.usage_point_id}/{self.measurement_direction}/annual/current"
else:
sub_prefix = f"{self.usage_point_id}/{self.measurement_direction}/annual/{date_begin_current.strftime('%Y')}"
Expand Down

0 comments on commit 7becf9e

Please sign in to comment.