Fixes the copy on new sessions, some additional styling work
This commit is contained in:
@@ -42,12 +42,9 @@ function RouteComponent() {
|
||||
// Check for a previous session
|
||||
const prevSession = await pb
|
||||
.collection("documents")
|
||||
.getFirstListItem(
|
||||
`campaign = "${campaign.id}" && json_extract(data, '$.session') != null`,
|
||||
{
|
||||
sort: "-created",
|
||||
},
|
||||
);
|
||||
.getFirstListItem(`campaign = "${campaign.id}" && type = 'session'`, {
|
||||
sort: "-created",
|
||||
});
|
||||
|
||||
console.log("Previous session: ", {
|
||||
id: prevSession.id,
|
||||
@@ -62,9 +59,7 @@ function RouteComponent() {
|
||||
},
|
||||
});
|
||||
|
||||
queryClient.invalidateQueries({ queryKey: ["campaign"] });
|
||||
|
||||
// If any, then copy things over
|
||||
// If any relations, then copy things over
|
||||
if (prevSession) {
|
||||
const prevRelations = await pb
|
||||
.collection<Relationship>("relationships")
|
||||
@@ -81,7 +76,7 @@ function RouteComponent() {
|
||||
await pb.collection("relationships").create({
|
||||
primary: newSession.id,
|
||||
type: relation.type,
|
||||
seciondary: relation.secondary,
|
||||
secondary: relation.secondary,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user