updated demo based on musicians feedback
This commit is contained in:
@@ -237,7 +237,7 @@
|
||||
type="text"
|
||||
name="tags"
|
||||
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"
|
||||
title="Comma-separated list. Leave blank to remove all tags"
|
||||
/>
|
||||
|
||||
@@ -453,7 +453,7 @@
|
||||
type="text"
|
||||
name="tags"
|
||||
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"
|
||||
title="Comma-separated list. Leave blank to remove all tags"
|
||||
/>
|
||||
|
||||
@@ -28,7 +28,14 @@ export async function GET() {
|
||||
// Get overall ratings
|
||||
const overallRatings = await db
|
||||
.select({
|
||||
overallRating,
|
||||
overallRating: {
|
||||
id: overallRating.id,
|
||||
participantId: overallRating.participantId,
|
||||
audioFileId: overallRating.audioFileId,
|
||||
value: overallRating.value,
|
||||
temporalValue: overallRating.temporalValue,
|
||||
createdAt: overallRating.createdAt
|
||||
},
|
||||
participant,
|
||||
audioFile,
|
||||
inviteLink
|
||||
@@ -96,14 +103,23 @@ export async function GET() {
|
||||
|
||||
// Ensure the participant exists in timeseriesData
|
||||
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]) {
|
||||
// Participant has overall rating but no timeseries data yet
|
||||
timeseriesData[audioId].participants[participantId] = {
|
||||
name: participantName,
|
||||
ratings: [],
|
||||
isCompleted: false,
|
||||
overallRating: entry.overallRating.value
|
||||
isCompleted: true,
|
||||
overallResponses: {
|
||||
temporal: entry.overallRating.temporalValue,
|
||||
overall: entry.overallRating.value,
|
||||
createdAt: entry.overallRating.createdAt
|
||||
}
|
||||
};
|
||||
} else {
|
||||
// Neither audio nor participant exists in timeseriesData yet
|
||||
@@ -113,8 +129,12 @@ export async function GET() {
|
||||
[participantId]: {
|
||||
name: participantName,
|
||||
ratings: [],
|
||||
isCompleted: false,
|
||||
overallRating: entry.overallRating.value
|
||||
isCompleted: true,
|
||||
overallResponses: {
|
||||
temporal: entry.overallRating.temporalValue,
|
||||
overall: entry.overallRating.value,
|
||||
createdAt: entry.overallRating.createdAt
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -132,6 +152,7 @@ export async function GET() {
|
||||
'Status',
|
||||
'Data Points Count',
|
||||
'Duration Covered (seconds)',
|
||||
'Temporal Rating (0-100)',
|
||||
'Overall Rating (0-100)',
|
||||
'Timeseries Data (timestamp:value pairs)',
|
||||
'Last Updated'
|
||||
@@ -155,8 +176,10 @@ export async function GET() {
|
||||
Math.max(...participantData.ratings.map(r => r.timestamp)) : 0;
|
||||
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;
|
||||
const lastUpdated = lastTimeseriesUpdate ?? (overallResponses ? new Date(overallResponses.createdAt) : null);
|
||||
|
||||
// Use the stored timeseries data from the rating record
|
||||
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.ratings.length,
|
||||
durationCovered.toFixed(2),
|
||||
participantData.overallRating !== undefined ? participantData.overallRating : '-',
|
||||
overallResponses?.temporal ?? '-',
|
||||
overallResponses?.overall ?? '-',
|
||||
timeseriesData,
|
||||
lastUpdated ? lastUpdated.toLocaleString() : '-'
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user