/* 
  Agora testando o BERNARDO SOARES -18/03/2021
  Verificar como índice de acerto é impactado por:
  - ok - Diferencia ZERO de NULL?;
  - ok - Realizar questão simples de múltipla escolha; 
  - ok - Questão aberta sem correção não pode contar no hitRate;
  - ok - Resetando o Cache Dashg atualiza; 
  - ok - Resolver questão pela segunda vez;
  - ok - Mostrar dados corretos no box da disciplina; 
  - ok - Identificar questão aberta SEM CORREÇÃO dentro da trilha; 
  - ok - Considerando uma questão fechada dentro de uma trilha que tem questão aberta; 
  - ok - Questão aberta é corrigida e entra na contagem; 
  - ok - Depois que são corrigidas todas   as questões, voltar a mostrar no índice; 
  - ok - Índice respondendo a múltiplas tentativas;
  - Parar de contar depois da tentativa 4 - COMPORTAMENTO SUSPENSO; 
  - ok - Anular questão; 
  - NÃO OK - Deletar Trilha - <Linha 156>;  
  - Deletar Tópico;
  - ok - Resetar resposta;
*/

r.db('MyTeacherTest')
  .table('hitRate')
row('user').eq('d34765df-1393-4030-9a21-3bb651a722ee') // ANTÔNIO BARREIROS
row('user').eq('b7b4b2c9-8b00-4146-acfe-2d5b618b1e71') // BERNARDO SOARES
row('user').eq('18f9da58-d96e-4013-896f-98ef53fcd3c9') // BRUNA COSTA
row('user').eq('1f49391f-81d6-436c-b4a3-318d8901432') // BRUNO PEREIRA
.and(row('subject').eq('7d7932dc-b24f-42de-96ab-fbaf39a6771c')) // DEPAS, 6º ano
.and(row('subject').eq('c7221eef-a944-4f08-87d4-6c59a09f71a5')) // BIBLIOTECA, 6º ano
.and(row('content').eq('65585de8-2908-435e-a02b-c27ad3bdcdfa')) // Teste CAMP-422
.and(row('resolution').eq(null)) // Sem resolution

// 'htRate' começa ZERADO para BRUNA COSTA
row('user').eq('18f9da58-d96e-4013-896f-98ef53fcd3c9') // BRUNA COSTA

// Aluna responde questão 1 ABERTA e 1 FECHADA, erra a fechada.
{
  "createdAt": 20210320001555 ,
  "hitCount": 0 ,
  "hitRate": 0 ,
  "hitUniqueCount": 0 ,
  "id": "4eb8a84e-d944-45b8-8e2a-384e63a13498" ,
  "responseCount": 1 ,
  "responseUniqueCount": 1 ,
  "stage": "ALL" ,
  "subject": "c7221eef-a944-4f08-87d4-6c59a09f71a5" ,
  "user": "18f9da58-d96e-4013-896f-98ef53fcd3c9"

}

// Respondendo pela segunda vez: Acertando 1 ABERTA e 2 FECHADAS sem correção

{
  "createdAt": 20210320002227 ,
  "hitCount": 1 ,
  "hitRate": 0.166667 ,
  "hitUniqueCount": 0 ,
  "id": "68ca2d70-e763-4e00-8ff7-9a99eda7b3e5" ,
  "responseCount": 2 ,
  "responseUniqueCount": 1 ,
  "stage": "ALL" ,
  "subject": "c7221eef-a944-4f08-87d4-6c59a09f71a5" ,
  "user": "18f9da58-d96e-4013-896f-98ef53fcd3c9"
}

// Professor corrige as duas questões abertas ABAIXO DA MÉDIA (corrigiu as questões da primeira tentativa)

{
  "createdAt": 20210320002551 ,
  "hitCount": 1 ,
  "hitRate": 0.083333 ,
  "hitUniqueCount": 0 ,
  "id": "70bc1315-e944-47b7-93d9-feb00587c2f7" ,
  "responseCount": 4 ,
  "responseUniqueCount": 3 ,
  "stage": "ALL" ,
  "subject": "c7221eef-a944-4f08-87d4-6c59a09f71a5" ,
  "user": "18f9da58-d96e-4013-896f-98ef53fcd3c9"
}

// Professor seleciona a SEGUNDA RESPOSTA na modal de tentativas. Ela não tem correção das duas abertas, mas a fechda está certa; 

{
  "createdAt": 20210320002802 ,
  "hitCount": 1 ,
  "hitRate": 0.75 ,
  "hitUniqueCount": 1 ,
  "id": "5e0fb26c-7456-4b64-9789-5548a7debac3" ,
  "responseCount": 4 ,
  "responseUniqueCount": 1 ,
  "stage": "ALL" ,
  "subject": "c7221eef-a944-4f08-87d4-6c59a09f71a5" ,
  "user": "18f9da58-d96e-4013-896f-98ef53fcd3c9"
}

// Professor corrige APENAS UMA ABERTA, mas abaixo da média.

{
  "createdAt": 20210320002932 ,
  "hitCount": 1 ,
  "hitRate": 0.4 ,
  "hitUniqueCount": 1 ,
  "id": "7778ffc3-a358-4106-95ba-53e05f2d13cc" ,
  "responseCount": 5 ,
  "responseUniqueCount": 2 ,
  "stage": "ALL" ,
  "subject": "c7221eef-a944-4f08-87d4-6c59a09f71a5" ,
  "user": "18f9da58-d96e-4013-896f-98ef53fcd3c9"
}

// Professor anula tentativas

{
  "createdAt": 20210320003223 ,
  "hitCount": 1 ,
  "hitRate": 0.2 ,
  "hitUniqueCount": 0 ,
  "id": "dd383052-351b-423f-97a9-b7a1483bb711" ,
  "responseCount": 5 ,
  "responseUniqueCount": 0 ,
  "stage": "ALL" ,
  "subject": "c7221eef-a944-4f08-87d4-6c59a09f71a5" ,
  "user": "18f9da58-d96e-4013-896f-98ef53fcd3c9"
}

// Professor reseta resposta

{
  "createdAt": 20210320003348 ,
  "hitCount": 0 ,
  "hitRate": 0 ,
  "hitUniqueCount": 0 ,
  "id": "7d08c317-84f9-4a5b-9001-ef48f2ee1408" ,
  "responseCount": 0 ,
  "responseUniqueCount": 0 ,
  "stage": "ALL" ,
  "subject": "c7221eef-a944-4f08-87d4-6c59a09f71a5" ,
  "user": "18f9da58-d96e-4013-896f-98ef53fcd3c9"
}

// Aluno responde NOVAMENTE depois de ter suas respostas resetadas. ACERTA 1 múltipla escolha e ABERTA sem corrigir

{
  "createdAt": 20210320003442 ,
  "hitCount": 1 ,
  "hitRate": 1 ,
  "hitUniqueCount": 1 ,
  "id": "2fcbaf8f-d0bc-4ca8-a3a9-f623ad985efd" ,
  "responseCount": 1 ,
  "responseUniqueCount": 1 ,
  "stage": "ALL" ,
  "subject": "c7221eef-a944-4f08-87d4-6c59a09f71a5" ,
  "user": "18f9da58-d96e-4013-896f-98ef53fcd3c9"
}

// Professor DELETA TRILHA

{
  "createdAt": 20210320003551 ,
  "hitCount": 1 ,
  "hitRate": 1 ,
  "hitUniqueCount": 1 ,
  "id": "704feb21-4a7f-4664-98b8-0667a90ba257" ,
  "responseCount": 1 ,
  "responseUniqueCount": 1 ,
  "stage": "ALL" ,
  "subject": "c7221eef-a944-4f08-87d4-6c59a09f71a5" ,
  "user": "18f9da58-d96e-4013-896f-98ef53fcd3c9"
}

// Aluna faz uma QUESTÃO FECHADA e acerta, faz duas abertas sem correção

{
  "createdAt": 20210320012454 ,
  "hitCount": 2 ,
  "hitRate": 1 ,
  "hitUniqueCount": 2 ,
  "id": "687eb0cf-65ad-4a06-82ff-73c79c25b1a5" ,
  "responseCount": 2 ,
  "responseUniqueCount": 2 ,
  "stage": "ALL" ,
  "subject": "c7221eef-a944-4f08-87d4-6c59a09f71a5" ,
  "user": "18f9da58-d96e-4013-896f-98ef53fcd3c9"
}

// Professor anula questão fechada

{
  "createdAt": 20210320012603 ,
  "hitCount": 1 ,
  "hitRate": 1 ,
  "hitUniqueCount": 1 ,
  "id": "648943a1-c59e-44a7-b4cb-473334465958" ,
  "responseCount": 1 ,
  "responseUniqueCount": 1 ,
  "stage": "ALL" ,
  "subject": "c7221eef-a944-4f08-87d4-6c59a09f71a5" ,
  "user": "18f9da58-d96e-4013-896f-98ef53fcd3c9"
}