2 Commits

Author SHA1 Message Date
af27bf74ef Version Bump v11.1.3 2023-08-04 19:16:00 +05:30
0fd84135dd Fix: Employee things were not working 2023-08-04 19:15:41 +05:30
10 changed files with 16 additions and 17 deletions

View File

@ -1 +1 @@
__version__ = "11.1.2"
__version__ = "11.1.3"

View File

@ -19,12 +19,12 @@ class Fingerprint:
id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, insert_default=uuid.uuid4)
employee_id: Mapped[uuid.UUID] = mapped_column(Uuid, ForeignKey("employees.id"), nullable=False)
date_: Mapped[datetime] = mapped_column(DateTime, nullable=False)
date_: Mapped[datetime] = mapped_column("date", DateTime, nullable=False)
employee: Mapped["Employee"] = relationship("Employee", back_populates="fingerprints")
def __init__(self, employee_id: uuid.UUID, date_: datetime, id_: uuid.UUID | None = None) -> None:
self.employee_id = employee_id
self.date = date_
self.date_ = date_
if id_ is not None:
self.id = id_

View File

@ -4,7 +4,6 @@ from decimal import Decimal
from typing import TYPE_CHECKING
from sqlalchemy import (
DECIMAL,
ColumnElement,
ForeignKey,
Numeric,

View File

@ -200,7 +200,7 @@ def employee_blank() -> schemas.EmployeeBlank:
designation="",
salary=0,
points=Decimal(0),
joining_date=datetime.today(),
joining_date=datetime.today().date(),
leaving_date=None,
)

View File

@ -109,10 +109,10 @@ def get_prints(employee_id: uuid.UUID, date_: date, db: Session) -> tuple[str, s
select(Fingerprint)
.where(
Fingerprint.employee_id == employee_id,
Fingerprint.date >= datetime.combine(date_, time(hour=7)),
Fingerprint.date < datetime.combine(date_ + timedelta(days=1), time(hour=7)),
Fingerprint.date_ >= datetime.combine(date_, time(hour=7)),
Fingerprint.date_ < datetime.combine(date_ + timedelta(days=1), time(hour=7)),
)
.order_by(Fingerprint.date)
.order_by(Fingerprint.date_)
)
.scalars()
.all()
@ -120,7 +120,7 @@ def get_prints(employee_id: uuid.UUID, date_: date, db: Session) -> tuple[str, s
last = None
for i in range(len(prints), 0, -1):
item = prints[i - 1].date
item = prints[i - 1].date_
if last is not None and last - item < timedelta(minutes=10):
prints.remove(prints[i - 1])
else:
@ -129,15 +129,15 @@ def get_prints(employee_id: uuid.UUID, date_: date, db: Session) -> tuple[str, s
if len(prints) == 0:
hours_worked, full_day = "", False
elif len(prints) == 2:
time_worked = prints[1].date - prints[0].date
time_worked = prints[1].date_ - prints[0].date_
hours_worked, full_day = working_hours(time_worked)
elif len(prints) == 4:
time_worked = (prints[1].date - prints[0].date) + (prints[3].date - prints[2].date)
time_worked = (prints[1].date_ - prints[0].date_) + (prints[3].date_ - prints[2].date_)
hours_worked, full_day = working_hours(time_worked)
else:
hours_worked, full_day = "Error", False
return (
", ".join([x.date.strftime("%H:%M") for x in prints]) + " ",
", ".join([x.date_.strftime("%H:%M") for x in prints]) + " ",
hours_worked,
full_day,
)

View File

@ -56,7 +56,7 @@ class EmployeeIn(AccountBase):
self.leaving_date = None
if (not self.is_active) and (self.leaving_date is None):
raise ValueError("Need leaving date for employee")
if self.leaving_date < self.joining_date:
if self.leaving_date is not None and self.leaving_date < self.joining_date:
raise ValueError("Leaving Date cannot be less than Joining Date")
return self

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "brewman"
version = "11.1.2"
version = "11.1.3"
description = "Accounting plus inventory management for a restaurant."
authors = ["tanshu <git@tanshu.com>"]

View File

@ -1,6 +1,6 @@
{
"name": "overlord",
"version": "11.1.2",
"version": "11.1.3",
"scripts": {
"ng": "ng",
"start": "ng serve",

View File

@ -2,5 +2,5 @@ export const environment = {
production: true,
// eslint-disable-next-line @typescript-eslint/naming-convention
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
version: '11.1.2',
version: '11.1.3',
};

View File

@ -6,7 +6,7 @@ export const environment = {
production: false,
// eslint-disable-next-line @typescript-eslint/naming-convention
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
version: '11.1.2',
version: '11.1.3',
};
/*