Forgot to add the device name to the csv file.
This commit is contained in:
parent
05ad84cc99
commit
30be98d6a5
@ -18,6 +18,7 @@ class Reading(BaseModel):
|
|||||||
temperature: float
|
temperature: float
|
||||||
humidity: float
|
humidity: float
|
||||||
age: int
|
age: int
|
||||||
|
device: str
|
||||||
|
|
||||||
|
|
||||||
@app.post("/upload", response_model=Reading)
|
@app.post("/upload", response_model=Reading)
|
||||||
@ -29,14 +30,14 @@ def add_reading(
|
|||||||
):
|
):
|
||||||
current_datetime = datetime.datetime.now()
|
current_datetime = datetime.datetime.now()
|
||||||
deducted_datetime = current_datetime - datetime.timedelta(milliseconds=age)
|
deducted_datetime = current_datetime - datetime.timedelta(milliseconds=age)
|
||||||
append_to_csv(settings.FILE_PATH, temp, humidity, deducted_datetime)
|
append_to_csv(settings.FILE_PATH, temp, humidity, deducted_datetime, device)
|
||||||
return Reading(temperature=temp, humidity=humidity, age=age)
|
return Reading(temperature=temp, humidity=humidity, age=age, device=device)
|
||||||
|
|
||||||
|
|
||||||
def append_to_csv(filename, temperature, humidity, datetime_var):
|
def append_to_csv(filename, temperature, humidity, datetime_var, device):
|
||||||
with open(filename, "a", newline="") as csvfile:
|
with open(filename, "a", newline="") as csvfile:
|
||||||
writer = csv.writer(csvfile)
|
writer = csv.writer(csvfile)
|
||||||
writer.writerow([temperature, humidity, datetime_var])
|
writer.writerow([temperature, humidity, datetime_var, device])
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
|
21
version_bump.sh
Executable file
21
version_bump.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
|
||||||
|
cd "$parent_path" || exit
|
||||||
|
|
||||||
|
if [ 1 -eq "$#" ]
|
||||||
|
then
|
||||||
|
echo "Version bump to $1"
|
||||||
|
sed --in-place --regexp-extended 's/version = "([0-9]*.[0-9].[0-9])"/version = "'"$1"'"/g' pyproject.toml
|
||||||
|
git add pyproject.toml
|
||||||
|
git commit -m "Version Bump v$1"
|
||||||
|
git tag "v$1"
|
||||||
|
else
|
||||||
|
echo "No version bump"
|
||||||
|
fi
|
||||||
|
git push
|
||||||
|
git tag --delete latest
|
||||||
|
git tag latest
|
||||||
|
git push --delete origin latest
|
||||||
|
git push --tags
|
Loading…
x
Reference in New Issue
Block a user