Merge pull request 'Исправление подсчета времени работы фабрики' (#9) from dev into main
Reviewed-on: http://git.hronos.su:8080/sabron/repcofkk/pulls/9
This commit is contained in:
commit
75da1ac249
@ -11,9 +11,12 @@ class FabricWorkTimeService(DashboardBaseService):
|
||||
@classmethod
|
||||
def calculate_work_time(cls, qs: list, return_duration: bool = False) -> dict:
|
||||
status_durations = {"WO": timedelta(0), "WA": timedelta(0), "NW": timedelta(0)}
|
||||
|
||||
time_now = cls.get_current_time()
|
||||
if not qs:
|
||||
return {"WO": 0, "WA": 0, "NW": 0}
|
||||
return {"WO": 0, "WA": 0, "NW": 0} if not return_duration else {"WO": "P0DT00H00M00S",
|
||||
"WA": "P0DT00H00M00S",
|
||||
"NW": time_now - cls.get_shift_start(
|
||||
time_now)}
|
||||
|
||||
previous_time = qs[0]["time"]
|
||||
previous_status = qs[0]["status"]
|
||||
@ -54,11 +57,7 @@ class FabricWorkTimeService(DashboardBaseService):
|
||||
now_date = self.get_current_time()
|
||||
start_month = now_date - relativedelta(hours=730)
|
||||
start_week = now_date - relativedelta(hours=168)
|
||||
start_shift = now_date.replace(hour=8, minute=0, second=0, microsecond=0)
|
||||
if now_date.hour < 8:
|
||||
start_shift = now_date.replace(hour=20, minute=0, second=0, microsecond=0) - relativedelta(days=1)
|
||||
elif now_date.hour > 20:
|
||||
start_shift = now_date.replace(hour=20, minute=0, second=0, microsecond=0)
|
||||
start_shift = self.get_shift_start(now_date)
|
||||
monthly_qs = self.get_qs_by_range(start_month, now_date)
|
||||
monthly = self.calculate_work_time(list(monthly_qs), return_durations)
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ INSTALLED_APPS = [
|
||||
"""Информация о приложении """
|
||||
SITE_TITLE = "Система отчетов"
|
||||
SITE_TITLE_S = "СиО"
|
||||
APP_VERSION = "0.5.1"
|
||||
APP_VERSION = "0.5.2"
|
||||
APP_VEK = "2024 г"
|
||||
APP_COPPIRIGHT = "Система отчетов"
|
||||
|
||||
|
||||
@ -112,6 +112,9 @@
|
||||
const spanSum = document.querySelector(`#${item}SUM`)
|
||||
spanSum.textContent = sumTimeString
|
||||
|
||||
if (workedWO.days !== 0) workedWO.hours += workedWO.days * 24
|
||||
if (workedWA.days !== 0) workedWA.hours += workedWA.days * 24
|
||||
if (workedNW.days !== 0) workedNW.hours += workedNW.days * 24
|
||||
switch (item) {
|
||||
case 'daily':
|
||||
dailyWorkChart.updateSeries([workedWO.hours, workedWA.hours, workedNW.hours])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user