Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove summary from retro reflection group #9851

Merged
merged 3 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions packages/server/database/types/ReflectionGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export interface ReflectionGroupInput {
voterIds?: string[]
title?: string
smartTitle?: string
summary?: string
discussionPromptQuestion?: string
}

Expand All @@ -25,7 +24,6 @@ export default class ReflectionGroup {
// userIds of the voters
voterIds: string[]
smartTitle: string | null
summary: string | null
title: string | null
discussionPromptQuestion: string | null
constructor(input: ReflectionGroupInput) {
Expand All @@ -38,7 +36,6 @@ export default class ReflectionGroup {
updatedAt,
voterIds,
smartTitle,
summary,
title,
discussionPromptQuestion
} = input
Expand All @@ -52,7 +49,6 @@ export default class ReflectionGroup {
this.updatedAt = updatedAt || now
this.voterIds = voterIds || []
this.smartTitle = smartTitle || null
this.summary = summary || null
this.title = title || null
this.discussionPromptQuestion = discussionPromptQuestion || null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,10 +658,6 @@ export const SlackNotifier = {
makeSection(`*Topic:*\n<${discussionUrl}|${topic}>`)
]

if (reflectionGroup.summary) {
slackBlocks.push(makeSection(`*Summary:*\n${reflectionGroup.summary}`))
}

slackBlocks.push(makeSection(`*Reflections:* \n${reflectionsText}`))

const notificationChannel = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {analytics} from '../../../utils/analytics/analytics'
import {getUserId} from '../../../utils/authorization'
import getPhase from '../../../utils/getPhase'
import publish from '../../../utils/publish'
import sendToSentry from '../../../utils/sendToSentry'
import standardError from '../../../utils/standardError'
import {InternalContext} from '../../graphql'
import sendNewMeetingSummary from './endMeeting/sendNewMeetingSummary'
Expand All @@ -35,7 +34,7 @@ const getTranscription = async (recallBotId?: string | null) => {
}

const summarizeRetroMeeting = async (meeting: MeetingRetrospective, context: InternalContext) => {
const {dataLoader, authToken} = context
const {dataLoader} = context
const {id: meetingId, phases, facilitatorUserId, teamId, recallBotId} = meeting
const r = await getRethink()
const [reflectionGroups, reflections, sentimentScore] = await Promise.all([
Expand All @@ -48,24 +47,6 @@ const summarizeRetroMeeting = async (meeting: MeetingRetrospective, context: Int
const discussionIds = stages.map((stage) => stage.discussionId)

const reflectionGroupIds = reflectionGroups.map(({id}) => id)
const hasTopicSummary = reflectionGroups.some((group) => group.summary)
if (hasTopicSummary) {
const groupsWithMissingTopicSummaries = reflectionGroups.filter((group) => {
const reflectionsInGroup = reflections.filter(
(reflection) => reflection.reflectionGroupId === group.id
)
return reflectionsInGroup.length > 1 && !group.summary
})
if (groupsWithMissingTopicSummaries.length > 0) {
const missingGroupIds = groupsWithMissingTopicSummaries.map(({id}) => id).join(', ')
const error = new Error('Missing AI topic summary')
const viewerId = getUserId(authToken)
sendToSentry(error, {
userId: viewerId,
tags: {missingGroupIds, meetingId}
})
}
}
const [summary, transcription] = await Promise.all([
generateWholeMeetingSummary(discussionIds, meetingId, teamId, facilitatorUserId, dataLoader),
getTranscription(recallBotId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const resetRetroMeetingToGroupStage = {
r.table('Task').getAll(r.args(discussionIdsToDelete), {index: 'discussionId'}).delete().run(),
pg
.updateTable('RetroReflectionGroup')
.set({voterIds: [], summary: null, discussionPromptQuestion: null})
.set({voterIds: [], discussionPromptQuestion: null})
.where('id', 'in', reflectionGroupIds)
.execute(),
r.table('NewMeeting').get(meetingId).update({phases: newPhases}).run(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import {Kysely, PostgresDialect} from 'kysely'
import {r} from 'rethinkdb-ts'
import connectRethinkDB from '../../database/connectRethinkDB'
import getPg from '../getPg'

export async function up() {
try {
await connectRethinkDB()

await r
.table('RetroReflectionGroup')
.replace((row) => row.without('summary'))
.run()

const pg = new Kysely<any>({
dialect: new PostgresDialect({
pool: getPg()
})
})

await pg.schema.alterTable('RetroReflectionGroup').dropColumn('summary').execute()
} catch (e) {
console.error('Error during migration:', e)
}
}

export async function down() {
try {
await connectRethinkDB()

await r.table('RetroReflectionGroup').update({summary: null}).run()

const pg = new Kysely<any>({
dialect: new PostgresDialect({
pool: getPg()
})
})

await pg.schema
.alterTable('RetroReflectionGroup')
.addColumn('summary', 'varchar(2000)')
.execute()
} catch (e) {
console.error('Error during rollback:', e)
}
}
Loading