Skip to content

Conversation

@Chloengr
Copy link
Contributor

@Chloengr Chloengr requested a review from Godefroy June 15, 2023 15:34
@netlify
Copy link

netlify bot commented Jun 15, 2023

Deploy Preview for rolebase ready!

Name Link
🔨 Latest commit 9777e5a
🔍 Latest deploy log https://app.netlify.com/sites/rolebase/deploys/6491c79aaf999100084a8565
😎 Deploy Preview https://deploy-preview-106--rolebase.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@Chloengr Chloengr force-pushed the chloe/meeting-concurrence branch from 2173d36 to 9777e5a Compare June 20, 2023 15:36
@Chloengr Chloengr marked this pull request as ready for review June 20, 2023 15:37
Copy link
Collaborator

@Godefroy Godefroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je t'ai mis quelques commentaires, notamment pour unifier la nomenclature autour du terme "Overlap" (plutôt que "atsametime", "confirm", "match") mais je pense qu'il serait intéressant d'imaginer un changement un peu plus important. Le state newMeeting et le chemin que la data prend avec la modale n'est pas très clair et peut être source d'erreurs lors de changements ultérieurs.

On pourrait calculer les participants ayant une réu au même moment dès qu'on a choisi un rôle et à chaque fois qu'on modifier la date ou la durée. La liste des participants et des meetings concernés pourraient être affichés dans une <Alert> en dessous de la date quand il y a un overlap plutôt que dans une modale.



query meetingsAtSameTime($NMstartDate: timestamptz!, $NMendDate: timestamptz!) {
meeting(where: { archived: {_eq: false},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il manque orgId. Là ça compare avec les réus de toutes les orgs.

{ startDate: { _gt: $NMstartDate }, endDate: { _lt: $NMendDate } },
{ startDate: { _lte: $NMstartDate }, endDate: { _gte: $NMendDate } },
{_and: [{ startDate: { _lte: $NMstartDate }, endDate: { _gte: $NMstartDate } }, { endDate: { _lte: $NMendDate } }]},
{_and: [{ startDate: { _gte: $NMstartDate }, endDate: { _gte: $NMendDate } }, { startDate: { _lt: $NMendDate } }]}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu dois pouvoir faire plus simple et performant avec la fonction postgres OVERLAPS.
https://database.guide/how-to-test-for-overlapping-dates-in-postgresql/

Je ne crois pas qu'Hasura supporte nativement cette fonction, donc tu peux créer une fonction Hasura getOverlappingMeetings :
https://hasura.io/docs/latest/schema/postgres/custom-functions/

{_and: [{ startDate: { _gte: $NMstartDate }, endDate: { _gte: $NMendDate } }, { startDate: { _lt: $NMendDate } }]}
]}) {
...MeetingSummary
archived
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pas besoin de récupérer archived

const [conflictingMeetings, setConflictingMeetings] = useState<
MeetingSummaryFragment[]
>([])
const [confirmModal, setConfirmModal] = useState(false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour faire pareil que pour les autres modales et pour renommer en overlapModal :

const overlapModal = useDisclosure()

onAccept: (currentMeeting: MeetingFormDataValues) => void
}

export default function MeetingConfirmModal({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renommer en MeetingOverlapModal

export type MeetingFormDataValues = Omit<
MeetingSummaryFragment,
'id' | 'orgId' | 'ended'
>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu dois pouvoir utiliser l'interface Values à la place

const circleId = watch('circleId')
const circle = useCircle(circleId)

const [checkConflictingMeetings] = useMeetingsAtSameTimeLazyQuery()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renommer en :
const [getOverlappingMeetings] = useGetOverlappingMeetings()

}


query meetingsAtSameTime($NMstartDate: timestamptz!, $NMendDate: timestamptz!) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je vais te proposer quelques changements de nomenclature pour mieux s'y retrouver.
Ici, renommer en getOverlappingMeetings

} catch (error) {
console.error(error)
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu peux réintégrer cette fonction dans onSubmit, ça sera plus lisible à mon avis.

meeting.participantsScope,
meeting.participantsMembersIds
).map((p) => p.member)
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il ne faut pas appeler un hook dans un map, car le nombre d'exécution peut varier et c'est interdit par React.
Il vaut mieux dans ce cas faire un map dans un useMemo et s'inspirer de la logique de useParticipants.
Tu peux faire le matching par la même occasion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants