feat: add jira filter url per participant and meeting jira url
This commit is contained in:
@@ -18,12 +18,13 @@ import (
|
||||
)
|
||||
|
||||
type App struct {
|
||||
ctx context.Context
|
||||
store *storage.Storage
|
||||
timer *timer.Timer
|
||||
session *models.MeetingSession
|
||||
currentLogs map[uint]*models.ParticipantLog
|
||||
updater *updater.Updater
|
||||
ctx context.Context
|
||||
store *storage.Storage
|
||||
timer *timer.Timer
|
||||
session *models.MeetingSession
|
||||
currentLogs map[uint]*models.ParticipantLog
|
||||
participantURLs map[uint]string
|
||||
updater *updater.Updater
|
||||
}
|
||||
|
||||
func New(store *storage.Storage) *App {
|
||||
@@ -85,16 +86,17 @@ func (a *App) GetParticipants() ([]models.Participant, error) {
|
||||
return a.store.GetParticipants()
|
||||
}
|
||||
|
||||
func (a *App) AddParticipant(name string, email string, timeLimit int) (*models.Participant, error) {
|
||||
func (a *App) AddParticipant(name string, email string, timeLimit int, jiraFilter string) (*models.Participant, error) {
|
||||
participants, _ := a.store.GetAllParticipants()
|
||||
order := len(participants)
|
||||
|
||||
p := &models.Participant{
|
||||
Name: name,
|
||||
Email: email,
|
||||
TimeLimit: timeLimit,
|
||||
Order: order,
|
||||
Active: true,
|
||||
Name: name,
|
||||
Email: email,
|
||||
JiraFilter: jiraFilter,
|
||||
TimeLimit: timeLimit,
|
||||
Order: order,
|
||||
Active: true,
|
||||
}
|
||||
|
||||
if err := a.store.CreateParticipant(p); err != nil {
|
||||
@@ -103,12 +105,13 @@ func (a *App) AddParticipant(name string, email string, timeLimit int) (*models.
|
||||
return p, nil
|
||||
}
|
||||
|
||||
func (a *App) UpdateParticipant(id uint, name string, email string, timeLimit int) error {
|
||||
func (a *App) UpdateParticipant(id uint, name string, email string, timeLimit int, jiraFilter string) error {
|
||||
p := &models.Participant{
|
||||
ID: id,
|
||||
Name: name,
|
||||
Email: email,
|
||||
TimeLimit: timeLimit,
|
||||
ID: id,
|
||||
Name: name,
|
||||
Email: email,
|
||||
JiraFilter: jiraFilter,
|
||||
TimeLimit: timeLimit,
|
||||
}
|
||||
return a.store.UpdateParticipant(p)
|
||||
}
|
||||
@@ -127,13 +130,14 @@ func (a *App) GetMeeting() (*models.Meeting, error) {
|
||||
return a.store.GetMeeting()
|
||||
}
|
||||
|
||||
func (a *App) UpdateMeeting(name string, timeLimit int) error {
|
||||
func (a *App) UpdateMeeting(name string, timeLimit int, jiraURL string) error {
|
||||
meeting, err := a.store.GetMeeting()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
meeting.Name = name
|
||||
meeting.TimeLimit = timeLimit
|
||||
meeting.JiraURL = jiraURL
|
||||
return a.store.UpdateMeeting(meeting)
|
||||
}
|
||||
|
||||
@@ -181,6 +185,17 @@ func (a *App) StartMeeting(participantOrder []uint, attendance map[uint]bool) er
|
||||
}
|
||||
}
|
||||
|
||||
a.participantURLs = make(map[uint]string)
|
||||
if meeting.JiraURL != "" {
|
||||
for _, p := range participants {
|
||||
url := meeting.JiraURL
|
||||
if p.JiraFilter != "" {
|
||||
url = meeting.JiraURL + "&quickFilter=" + p.JiraFilter
|
||||
}
|
||||
a.participantURLs[p.ID] = url
|
||||
}
|
||||
}
|
||||
|
||||
a.timer = timer.New(meeting.TimeLimit, warningThreshold)
|
||||
a.timer.SetQueue(queue)
|
||||
a.currentLogs = make(map[uint]*models.ParticipantLog)
|
||||
@@ -205,6 +220,9 @@ func (a *App) handleTimerEvents() {
|
||||
runtime.EventsEmit(a.ctx, "timer:meeting_timeup", event.State)
|
||||
case timer.EventSpeakerChanged:
|
||||
a.saveSpeakerLog(event.State)
|
||||
if url, ok := a.participantURLs[event.State.CurrentSpeakerID]; ok && url != "" {
|
||||
runtime.BrowserOpenURL(a.ctx, url)
|
||||
}
|
||||
runtime.EventsEmit(a.ctx, "timer:speaker_changed", event.State)
|
||||
case timer.EventMeetingEnded:
|
||||
a.finalizeSpeakerLogs(event.State)
|
||||
|
||||
Reference in New Issue
Block a user