[ RESOLVIDO ]PODEM ME AJUDAR COM ESSA LÓGICA
const _APOSTA_RESULTADO = [ 12, 16, 19, 32, 33, 57 ]
const APOSTAS =[
{
id: '5a56fd9b-4b1a-4861-8cf3-8e6cbe08984b',
establishmentId: '1',
number_game_result: '97',
numbers: '7,8,11,12,13,20,21,23,29,33,35,40,43,44,49,51,52,55,56,57',
status: 'IN_PROCESSING',
awarded: false,
hits: 0,
namber_bet: 39,
created_at: 2023-05-19T22:02:04.480Z,
updated_at: 2023-05-19T22:02:04.480Z
},
{
id: '79f7ac62-3579-41e6-bdca-c939efc8d8d7',
establishmentId: '1',
number_game_result: '97',
numbers: '5,8,10,11,19,23,25,27,36,38,39,40,41,42,43,46,48,56,59,60',
status: 'IN_PROCESSING',
awarded: false,
hits: 0,
namber_bet: 36,
created_at: 2023-05-19T22:02:02.204Z,
updated_at: 2023-05-19T22:02:02.204Z
},
{
id: 'ac8c9b26-21b6-4fa2-a27b-752722f3ef6d',
establishmentId: '1',
number_game_result: '97',
numbers: '1,8,10,13,18,22,23,24,31,32,35,36,37,38,40,42,44,49,51,57',
status: 'IN_PROCESSING',
awarded: false,
hits: 0,
namber_bet: 37,
created_at: 2023-05-19T22:02:02.973Z,
updated_at: 2023-05-19T22:02:02.973Z
},
{
id: 'bd4c9d82-84fc-4863-a870-50e73f6c0edd',
establishmentId: '1',
number_game_result: '97',
numbers: '2,5,6,11,14,20,21,23,26,29,32,39,41,45,51,52,55,56,57,59',
status: 'IN_PROCESSING',
awarded: false,
hits: 0,
namber_bet: 38,
created_at: 2023-05-19T22:02:03.694Z,
updated_at: 2023-05-19T22:02:03.694Z
}
]
https://www.youtube.com/watch?v=NMeUcCfytbk&ab_channel=HeuderSena
Git: https://github.com/heudersena/game-mega-sena
Sobre o array de aposta tenho algo semelhante vindo do banco de dados.
Sou bem iniciante e me encontro a 2 dias pesquisando e tentando chegar no seguinte resltado.
Eu preciso passar por cada APOSTAS verificando se no _APOSTA_RESULTADO existe numeros iguais, se existir ir contabilizando. Caso tem acertos, atualizar o campo acertos com a quantidade de acertos!
Se alguem poder me ajudar, juro que fico muito agradecido!!!