mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
use utc isoformat with help of 'arrow'
This commit is contained in:
parent
79f592aaf3
commit
3d7e02a550
2 changed files with 10 additions and 12 deletions
|
|
@ -11,6 +11,7 @@ import inspect
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
import arrow
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
|
|
||||||
from openpype import AYON_SERVER_ENABLED
|
from openpype import AYON_SERVER_ENABLED
|
||||||
|
|
@ -287,7 +288,7 @@ class PublishReportMaker:
|
||||||
def get_report(self, publish_plugins=None):
|
def get_report(self, publish_plugins=None):
|
||||||
"""Report data with all details of current state."""
|
"""Report data with all details of current state."""
|
||||||
|
|
||||||
now = datetime.datetime.now()
|
now = arrow.utcnow().to("local")
|
||||||
instances_details = {}
|
instances_details = {}
|
||||||
for instance in self._all_instances_by_id.values():
|
for instance in self._all_instances_by_id.values():
|
||||||
instances_details[instance.id] = self._extract_instance_data(
|
instances_details[instance.id] = self._extract_instance_data(
|
||||||
|
|
@ -337,7 +338,7 @@ class PublishReportMaker:
|
||||||
"context": self._extract_context_data(self._current_context),
|
"context": self._extract_context_data(self._current_context),
|
||||||
"crashed_file_paths": crashed_file_paths,
|
"crashed_file_paths": crashed_file_paths,
|
||||||
"id": uuid.uuid4().hex,
|
"id": uuid.uuid4().hex,
|
||||||
"created_at": now.strftime("%Y-%m-%d %H:%M:%S"),
|
"created_at": now.isoformat(),
|
||||||
"report_version": "1.0.1",
|
"report_version": "1.0.1",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ import os
|
||||||
import json
|
import json
|
||||||
import six
|
import six
|
||||||
import uuid
|
import uuid
|
||||||
import datetime
|
|
||||||
|
|
||||||
import appdirs
|
import appdirs
|
||||||
|
import arrow
|
||||||
from qtpy import QtWidgets, QtCore, QtGui
|
from qtpy import QtWidgets, QtCore, QtGui
|
||||||
|
|
||||||
from openpype import style
|
from openpype import style
|
||||||
|
|
@ -56,10 +56,8 @@ class PublishReportItem:
|
||||||
if os.path.exists(report_path):
|
if os.path.exists(report_path):
|
||||||
file_modified = os.path.getmtime(report_path)
|
file_modified = os.path.getmtime(report_path)
|
||||||
|
|
||||||
created_at_obj = datetime.datetime.strptime(
|
created_at_obj = arrow.get(content["created_at"]).to("local")
|
||||||
content["created_at"], "%Y-%m-%d %H:%M:%S"
|
created_at = created_at_obj.float_timestamp
|
||||||
)
|
|
||||||
created_at = created_at_obj.timestamp()
|
|
||||||
|
|
||||||
self.content = content
|
self.content = content
|
||||||
self.report_path = report_path
|
self.report_path = report_path
|
||||||
|
|
@ -243,10 +241,10 @@ class PublishReportItem:
|
||||||
# Auto fix 'created_at', use file modification time if it is not set
|
# Auto fix 'created_at', use file modification time if it is not set
|
||||||
# or current time if modification could not be received.
|
# or current time if modification could not be received.
|
||||||
if file_modified is not None:
|
if file_modified is not None:
|
||||||
created_at_obj = datetime.datetime.fromtimestamp(file_modified)
|
created_at_obj = arrow.Arrow.fromtimestamp(file_modified)
|
||||||
else:
|
else:
|
||||||
created_at_obj = datetime.datetime.now()
|
created_at_obj = arrow.utcnow()
|
||||||
content["created_at"] = created_at_obj.strftime("%Y-%m-%d %H:%M:%S")
|
content["created_at"] = created_at_obj.to("local").isoformat()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -320,9 +318,8 @@ class LoadedFilesModel(QtGui.QStandardItemModel):
|
||||||
|
|
||||||
def refresh(self):
|
def refresh(self):
|
||||||
root_item = self.invisibleRootItem()
|
root_item = self.invisibleRootItem()
|
||||||
if root_item.rowCount():
|
if root_item.rowCount() > 0:
|
||||||
root_item.removeRows(0, root_item.rowCount())
|
root_item.removeRows(0, root_item.rowCount())
|
||||||
|
|
||||||
self._items_by_id = {}
|
self._items_by_id = {}
|
||||||
self._report_items_by_id = {}
|
self._report_items_by_id = {}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue