Skip to content

Commit

Permalink
Use the lastMetAt field for Team type in orgTeamsView
Browse files Browse the repository at this point in the history
  • Loading branch information
tianrunhe committed Feb 11, 2025
1 parent 5ed0b27 commit 0c061a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ const OrgTeams = (props: Props) => {
allTeams {
id
name
activeMeetings {
id
createdAt
}
lastMetAt
teamMembers {
id
}
Expand Down Expand Up @@ -74,12 +71,12 @@ const OrgTeams = (props: Props) => {
return direction * (a.teamMembers.length - b.teamMembers.length)
} else {
// lastMetAt
const aLastMeeting = a.activeMeetings[0]?.createdAt
const bLastMeeting = b.activeMeetings[0]?.createdAt
if (!aLastMeeting && !bLastMeeting) return 0
if (!aLastMeeting) return -direction
if (!bLastMeeting) return direction
return direction * (new Date(aLastMeeting).getTime() - new Date(bLastMeeting).getTime())
const aLastMet = a.lastMetAt
const bLastMet = b.lastMetAt
if (!aLastMet && !bLastMet) return 0
if (!aLastMet) return -direction
if (!bLastMet) return direction
return direction * (new Date(aLastMet).getTime() - new Date(bLastMet).getTime())
}
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@ const OrgTeamsRow = (props: Props) => {
isLead
preferredName
}
activeMeetings {
id
createdAt
}
lastMetAt
}
`,
teamRef
)
const {id: teamId, teamMembers, name, activeMeetings} = team
const {id: teamId, teamMembers, name, lastMetAt} = team
const teamMembersCount = teamMembers.length
const viewerTeamMember = teamMembers.find((m) => m.isSelf)
const isLead = viewerTeamMember?.isLead
Expand Down Expand Up @@ -60,9 +57,7 @@ const OrgTeamsRow = (props: Props) => {
</td>
<td className='text-gray-600 p-3'>{teamMembersCount}</td>
<td className='text-gray-600 p-3'>
{activeMeetings[0]?.createdAt
? format(new Date(activeMeetings[0].createdAt), 'yyyy-MM-dd')
: 'Never'}
{lastMetAt ? format(new Date(lastMetAt), 'yyyy-MM-dd') : 'Never'}
</td>
</tr>
)
Expand Down

0 comments on commit 0c061a9

Please sign in to comment.