mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
SyncServer - fix priority on remote sites
This commit is contained in:
parent
5d40c9e31e
commit
999e1b78fd
3 changed files with 32 additions and 11 deletions
|
|
@ -717,9 +717,15 @@ class SyncServerModule(PypeModule, ITrayModule):
|
|||
}},
|
||||
{'$addFields': {
|
||||
'priority': {
|
||||
'$cond': [{'$size': '$order_local.priority'},
|
||||
{'$first': '$order_local.priority'},
|
||||
self.DEFAULT_PRIORITY]}
|
||||
'$cond': [
|
||||
{'$size': '$order_local.priority'},
|
||||
{'$first': '$order_local.priority'},
|
||||
{'$cond': [
|
||||
{'$size': '$order_remote.priority'},
|
||||
{'$first': '$order_remote.priority'},
|
||||
self.DEFAULT_PRIORITY]}
|
||||
]
|
||||
},
|
||||
}},
|
||||
{'$group': {
|
||||
'_id': '$_id',
|
||||
|
|
|
|||
|
|
@ -36,13 +36,16 @@ class PriorityDelegate(QtWidgets.QStyledItemDelegate):
|
|||
editor = PriorityLineEdit(
|
||||
parent,
|
||||
option.widget.selectionModel().selectedRows())
|
||||
editor.setValidator(QtGui.QIntValidator(0, 1000, self))
|
||||
editor.setFocus(True)
|
||||
return editor
|
||||
|
||||
def setModelData(self, editor, model, index):
|
||||
for index in editor.selected_idxs:
|
||||
model.set_priority_data(index, editor.text())
|
||||
try:
|
||||
val = int(editor.text())
|
||||
except ValueError:
|
||||
val = model.sync_server.DEFAULT_PRIORITY
|
||||
model.set_priority_data(index, val)
|
||||
|
||||
|
||||
class PriorityLineEdit(QtWidgets.QLineEdit):
|
||||
|
|
|
|||
|
|
@ -691,9 +691,15 @@ class SyncRepresentationSummaryModel(_SyncRepresentationModel):
|
|||
1,
|
||||
0]},
|
||||
'priority': {
|
||||
'$cond': [{'$size': '$order_local.priority'},
|
||||
{'$first': '$order_local.priority'},
|
||||
self.sync_server.DEFAULT_PRIORITY]},
|
||||
'$cond': [
|
||||
{'$size': '$order_local.priority'},
|
||||
{'$first': '$order_local.priority'},
|
||||
{'$cond': [
|
||||
{'$size': '$order_remote.priority'},
|
||||
{'$first': '$order_remote.priority'},
|
||||
self.sync_server.DEFAULT_PRIORITY]}
|
||||
]
|
||||
},
|
||||
}},
|
||||
{'$group': {
|
||||
'_id': '$_id',
|
||||
|
|
@ -1204,9 +1210,15 @@ class SyncRepresentationDetailModel(_SyncRepresentationModel):
|
|||
]}
|
||||
]}},
|
||||
'priority': {
|
||||
'$cond': [{'$size': '$order_local.priority'},
|
||||
{'$first': '$order_local.priority'},
|
||||
self.sync_server.DEFAULT_PRIORITY]}
|
||||
'$cond': [
|
||||
{'$size': '$order_local.priority'},
|
||||
{'$first': '$order_local.priority'},
|
||||
{'$cond': [
|
||||
{'$size': '$order_remote.priority'},
|
||||
{'$first': '$order_remote.priority'},
|
||||
self.sync_server.DEFAULT_PRIORITY]}
|
||||
]
|
||||
},
|
||||
}},
|
||||
{"$project": self.projection}
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue