2 Commits

Author SHA1 Message Date
35147d2248 Version Bump v0.0.3 2023-07-07 07:13:53 +05:30
30be98d6a5 Forgot to add the device name to the csv file. 2023-07-07 07:13:47 +05:30
3 changed files with 27 additions and 5 deletions

View File

@ -18,6 +18,7 @@ class Reading(BaseModel):
temperature: float
humidity: float
age: int
device: str
@app.post("/upload", response_model=Reading)
@ -29,14 +30,14 @@ def add_reading(
):
current_datetime = datetime.datetime.now()
deducted_datetime = current_datetime - datetime.timedelta(milliseconds=age)
append_to_csv(settings.FILE_PATH, temp, humidity, deducted_datetime)
return Reading(temperature=temp, humidity=humidity, age=age)
append_to_csv(settings.FILE_PATH, temp, humidity, deducted_datetime, device)
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:
writer = csv.writer(csvfile)
writer.writerow([temperature, humidity, datetime_var])
writer.writerow([temperature, humidity, datetime_var, device])
def init():

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "gru"
version = "0.0.2"
version = "0.0.3"
description = "Sensor manager."
authors = ["tanshu <git@tanshu.com>"]

21
version_bump.sh Executable file
View 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