mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 19:11:33 +03:00
Fix workslots calendar (#5838)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
b1d7fd03a9
commit
bcae079c5c
@ -84,7 +84,6 @@
|
||||
rank: makeRank(undefined, latestTodo?.rank)
|
||||
}
|
||||
)
|
||||
const _calendar = `${acc._id}_calendar` as Ref<Calendar>
|
||||
for (const slot of slots) {
|
||||
await ops.addCollection(time.class.WorkSlot, calendar.space.Calendar, id, time.class.ToDo, 'workslots', {
|
||||
eventId: generateEventId(),
|
||||
@ -111,7 +110,7 @@
|
||||
let _calendar: Ref<Calendar> = `${currentUser._id}_calendar` as Ref<Calendar>
|
||||
|
||||
const q = createQuery()
|
||||
q.query(calendar.class.ExternalCalendar, { default: true, members: currentUser._id }, (res) => {
|
||||
q.query(calendar.class.ExternalCalendar, { default: true, hidden: false, createdBy: currentUser._id }, (res) => {
|
||||
if (res.length > 0) {
|
||||
_calendar = res[0]._id
|
||||
}
|
||||
|
@ -52,7 +52,7 @@
|
||||
const date = e.detail.date.getTime()
|
||||
const currentUser = getCurrentAccount() as PersonAccount
|
||||
const extCalendar = await client.findOne(calendar.class.ExternalCalendar, {
|
||||
members: currentUser._id,
|
||||
createdBy: currentUser._id,
|
||||
hidden: false,
|
||||
default: true
|
||||
})
|
||||
|
@ -55,7 +55,12 @@
|
||||
const now = Date.now()
|
||||
const date = Math.ceil(now / (30 * 60 * 1000)) * (30 * 60 * 1000)
|
||||
const currentUser = getCurrentAccount() as PersonAccount
|
||||
const _calendar = `${currentUser._id}_calendar` as Ref<Calendar>
|
||||
const extCalendar = await client.findOne(calendar.class.ExternalCalendar, {
|
||||
createdBy: currentUser._id,
|
||||
hidden: false,
|
||||
default: true
|
||||
})
|
||||
const _calendar = extCalendar ? extCalendar._id : (`${currentUser._id}_calendar` as Ref<Calendar>)
|
||||
const dueDate = date + defaultDuration
|
||||
await client.addCollection(time.class.WorkSlot, calendar.space.Calendar, todo._id, todo._class, 'workslots', {
|
||||
eventId: generateEventId(),
|
||||
|
Loading…
Reference in New Issue
Block a user