updated demo based on musicians feedback
This commit is contained in:
@@ -237,7 +237,7 @@
|
|||||||
type="text"
|
type="text"
|
||||||
name="tags"
|
name="tags"
|
||||||
value={invite.tags?.join(', ') ?? ''}
|
value={invite.tags?.join(', ') ?? ''}
|
||||||
placeholder="beta, cohort-a"
|
placeholder="tag1, tag2, tag3"
|
||||||
class="w-full rounded-md border-gray-300 px-2 py-1 text-xs focus:border-indigo-500 focus:ring-indigo-500"
|
class="w-full rounded-md border-gray-300 px-2 py-1 text-xs focus:border-indigo-500 focus:ring-indigo-500"
|
||||||
title="Comma-separated list. Leave blank to remove all tags"
|
title="Comma-separated list. Leave blank to remove all tags"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -453,7 +453,7 @@
|
|||||||
type="text"
|
type="text"
|
||||||
name="tags"
|
name="tags"
|
||||||
value={audio.tags?.join(', ') ?? ''}
|
value={audio.tags?.join(', ') ?? ''}
|
||||||
placeholder="rock, jazz, intro"
|
placeholder="tag1, tag2, tag3"
|
||||||
class="w-full rounded-md border-gray-300 px-2 py-1 text-xs focus:border-indigo-500 focus:ring-indigo-500"
|
class="w-full rounded-md border-gray-300 px-2 py-1 text-xs focus:border-indigo-500 focus:ring-indigo-500"
|
||||||
title="Comma-separated list. Leave blank to remove all tags"
|
title="Comma-separated list. Leave blank to remove all tags"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -28,7 +28,14 @@ export async function GET() {
|
|||||||
// Get overall ratings
|
// Get overall ratings
|
||||||
const overallRatings = await db
|
const overallRatings = await db
|
||||||
.select({
|
.select({
|
||||||
overallRating,
|
overallRating: {
|
||||||
|
id: overallRating.id,
|
||||||
|
participantId: overallRating.participantId,
|
||||||
|
audioFileId: overallRating.audioFileId,
|
||||||
|
value: overallRating.value,
|
||||||
|
temporalValue: overallRating.temporalValue,
|
||||||
|
createdAt: overallRating.createdAt
|
||||||
|
},
|
||||||
participant,
|
participant,
|
||||||
audioFile,
|
audioFile,
|
||||||
inviteLink
|
inviteLink
|
||||||
@@ -96,14 +103,23 @@ export async function GET() {
|
|||||||
|
|
||||||
// Ensure the participant exists in timeseriesData
|
// Ensure the participant exists in timeseriesData
|
||||||
if (timeseriesData[audioId] && timeseriesData[audioId].participants[participantId]) {
|
if (timeseriesData[audioId] && timeseriesData[audioId].participants[participantId]) {
|
||||||
timeseriesData[audioId].participants[participantId].overallRating = entry.overallRating.value;
|
timeseriesData[audioId].participants[participantId].overallResponses = {
|
||||||
|
temporal: entry.overallRating.temporalValue,
|
||||||
|
overall: entry.overallRating.value,
|
||||||
|
createdAt: entry.overallRating.createdAt
|
||||||
|
};
|
||||||
|
timeseriesData[audioId].participants[participantId].isCompleted = true;
|
||||||
} else if (timeseriesData[audioId]) {
|
} else if (timeseriesData[audioId]) {
|
||||||
// Participant has overall rating but no timeseries data yet
|
// Participant has overall rating but no timeseries data yet
|
||||||
timeseriesData[audioId].participants[participantId] = {
|
timeseriesData[audioId].participants[participantId] = {
|
||||||
name: participantName,
|
name: participantName,
|
||||||
ratings: [],
|
ratings: [],
|
||||||
isCompleted: false,
|
isCompleted: true,
|
||||||
overallRating: entry.overallRating.value
|
overallResponses: {
|
||||||
|
temporal: entry.overallRating.temporalValue,
|
||||||
|
overall: entry.overallRating.value,
|
||||||
|
createdAt: entry.overallRating.createdAt
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// Neither audio nor participant exists in timeseriesData yet
|
// Neither audio nor participant exists in timeseriesData yet
|
||||||
@@ -113,8 +129,12 @@ export async function GET() {
|
|||||||
[participantId]: {
|
[participantId]: {
|
||||||
name: participantName,
|
name: participantName,
|
||||||
ratings: [],
|
ratings: [],
|
||||||
isCompleted: false,
|
isCompleted: true,
|
||||||
overallRating: entry.overallRating.value
|
overallResponses: {
|
||||||
|
temporal: entry.overallRating.temporalValue,
|
||||||
|
overall: entry.overallRating.value,
|
||||||
|
createdAt: entry.overallRating.createdAt
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -132,6 +152,7 @@ export async function GET() {
|
|||||||
'Status',
|
'Status',
|
||||||
'Data Points Count',
|
'Data Points Count',
|
||||||
'Duration Covered (seconds)',
|
'Duration Covered (seconds)',
|
||||||
|
'Temporal Rating (0-100)',
|
||||||
'Overall Rating (0-100)',
|
'Overall Rating (0-100)',
|
||||||
'Timeseries Data (timestamp:value pairs)',
|
'Timeseries Data (timestamp:value pairs)',
|
||||||
'Last Updated'
|
'Last Updated'
|
||||||
@@ -155,8 +176,10 @@ export async function GET() {
|
|||||||
Math.max(...participantData.ratings.map(r => r.timestamp)) : 0;
|
Math.max(...participantData.ratings.map(r => r.timestamp)) : 0;
|
||||||
const durationCovered = maxTimestamp - minTimestamp;
|
const durationCovered = maxTimestamp - minTimestamp;
|
||||||
|
|
||||||
const lastUpdated = participantData.ratings.length > 0 ?
|
const overallResponses = participantData.overallResponses;
|
||||||
|
const lastTimeseriesUpdate = participantData.ratings.length > 0 ?
|
||||||
new Date(Math.max(...participantData.ratings.map(r => new Date(r.createdAt).getTime()))) : null;
|
new Date(Math.max(...participantData.ratings.map(r => new Date(r.createdAt).getTime()))) : null;
|
||||||
|
const lastUpdated = lastTimeseriesUpdate ?? (overallResponses ? new Date(overallResponses.createdAt) : null);
|
||||||
|
|
||||||
// Use the stored timeseries data from the rating record
|
// Use the stored timeseries data from the rating record
|
||||||
const timeseriesData = participantData.ratings.find(r => r.isCompleted && r.timeseriesData)?.timeseriesData ||
|
const timeseriesData = participantData.ratings.find(r => r.isCompleted && r.timeseriesData)?.timeseriesData ||
|
||||||
@@ -168,7 +191,8 @@ export async function GET() {
|
|||||||
participantData.isCompleted ? 'Completed' : 'In Progress',
|
participantData.isCompleted ? 'Completed' : 'In Progress',
|
||||||
participantData.ratings.length,
|
participantData.ratings.length,
|
||||||
durationCovered.toFixed(2),
|
durationCovered.toFixed(2),
|
||||||
participantData.overallRating !== undefined ? participantData.overallRating : '-',
|
overallResponses?.temporal ?? '-',
|
||||||
|
overallResponses?.overall ?? '-',
|
||||||
timeseriesData,
|
timeseriesData,
|
||||||
lastUpdated ? lastUpdated.toLocaleString() : '-'
|
lastUpdated ? lastUpdated.toLocaleString() : '-'
|
||||||
]);
|
]);
|
||||||
@@ -208,4 +232,4 @@ export async function GET() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user