require('dotenv').config();
const { createClient } = require('@supabase/supabase-js');
const sb = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_SERVICE_KEY);
(async()=>{
  const {data:subs} = await sb.from('submissions')
    .select('id,status,created_at,task_id,worker_id,content')
    .eq('status','in_progress')
    .order('created_at',{ascending:true});
  console.log('In-progress submissions:',subs.length);
  subs.forEach(s=>{
    const daysOld = Math.floor((new Date()-new Date(s.created_at))/86400000);
    console.log('\n---');
    console.log('Sub ID:',s.id);
    console.log('Task ID:',s.task_id);
    console.log('Days waiting:',daysOld);
    console.log('Content:',JSON.stringify(s.content)?.slice(0,100)||'empty');
  });
})();
