WIP(teams): various fixes

This commit is contained in:
SabreCat
2022-02-07 20:22:57 -06:00
parent e312ea943f
commit 82d3545c08
4 changed files with 34 additions and 22 deletions
@@ -39,13 +39,13 @@
v-if="task.group.assignedUsers"
>
<span
v-if="completionsCount"
v-if="assignedUsersCount > 1 && completionsCount && !showStatus"
class="mr-1"
>
{{ completionsCount }}/{{ assignedUsersCount }}
</span>
<a
v-if="!showStatus"
v-if="assignedUsersCount > 1 && !showStatus"
class="blue-10"
@click="showStatus = !showStatus"
>
@@ -132,24 +132,27 @@ export default {
}, 0);
},
completionsList () {
if (this.assignedUsersCount === 1) return [];
const completionsArray = [];
for (const userId of this.assignedUsersKeys) {
const index = findIndex(this.group.members, member => member._id === userId);
const { completedDate } = this.task.group.assignedUsers[userId];
let completedDateString;
if (completedDate && moment().diff(completedDate, 'days') > 0) {
completedDateString = `Last completed ${moment(completedDate).format('M/D/YY')}`;
} else {
completedDateString = `Completed today at ${moment(completedDate).format('h:mm A')}`;
if (userId !== this.user._id) {
const index = findIndex(this.group.members, member => member._id === userId);
const { completedDate } = this.task.group.assignedUsers[userId];
let completedDateString;
if (completedDate && moment().diff(completedDate, 'days') > 0) {
completedDateString = `Last completed ${moment(completedDate).format('M/D/YY')}`;
} else {
completedDateString = `Completed today at ${moment(completedDate).format('h:mm A')}`;
}
completionsArray.push({
userId,
userName: this.group.members[index].auth.local.username,
completed: this.task.group.assignedUsers[userId].completed,
completedDate,
completedDateString,
completedToday: moment().diff(completedDate, 'days') === 0,
});
}
completionsArray.push({
userId,
userName: this.group.members[index].auth.local.username,
completed: this.task.group.assignedUsers[userId].completed,
completedDate,
completedDateString,
completedToday: moment().diff(completedDate, 'days') === 0,
});
}
return completionsArray;
},
+5 -1
View File
@@ -869,6 +869,7 @@
import moment from 'moment';
import { v4 as uuid } from 'uuid';
import isEmpty from 'lodash/isEmpty';
import keys from 'lodash/keys';
import { mapState, mapGetters, mapActions } from '@/libs/store';
import positiveIcon from '@/assets/svg/positive.svg';
@@ -1059,7 +1060,10 @@ export default {
return false;
}
if (this.task.group.completedBy.userId === this.user._id) return false;
if (this.teamManagerAccess && !this.task.group.assignedUsers) return false;
if (this.teamManagerAccess) {
if (!this.task.group.assignedUsers) return false;
if (keys(this.task.group.assignedUsers).length === 1) return false;
}
return true;
}
if (this.isOpenTask) return false;