<commit_before>﻿select * from configuraciontrampas 

insert into eventos (semana,fechaevento,createdby,modifiedby,idconfiguraciontrampa) 
values (2,'2016-01-04','YO','YO',1);

insert into eventos (semana,fechaevento,createdby,modifiedby,idconfiguraciontrampa) 
values (2,'2016-01-04','YO','YO',1);

insert into eventos (semana,fechaevento,createdby,modifiedby,idconfiguraciontrampa) 
values (2,'2016-01-11','YO','YO',2);

select * from eventos 

insert into detalleeventos (quantity,createdby,modifiedby,idevento,idplaga) 
values (4,'YO','YO',1,5);

insert into detalleeventos (quantity,createdby,modifiedby,idevento,idplaga) 
values (4,'YO','YO',2,5);

insert into detalleeventos (quantity,createdby,modifiedby,idevento,idplaga) 
values (2,'YO','YO',1,9);

insert into detalleeventos (quantity,createdby,modifiedby,idevento,idplaga) 
values (6,'YO','YO',3,8);

insert into detalleeventos (quantity,createdby,modifiedby,idevento,idplaga) 
values (6,'YO','YO',3,14);

insert into detalleeventos (quantity,createdby,modifiedby,idevento,idplaga) 
values (6,'YO','YO',4,18);

insert into detalleeventos (quantity,createdby,modifiedby,idevento,idplaga) 
values (6,'YO','YO',4,27);

select * from detalleeventos 


select e.id,pl.name,ct.numerotrampa,e.semana,e.fechaevento,de.quantity,p.name from eventos e
inner join detalleeventos de on e.id = de.idevento
inner join plagas p on de.idplaga = p.id
inner join configuraciontrampas ct  on e.idconfiguraciontrampa=ct.id
inner join plantas pl on ct.idplanta = pl.id


--sumar las plagas, filtar por intervlo de fechas y por planta
-- filtrar por clasificacion tambien
select SUM(de.quantity) as quantity,p.name,e.fechaevento 
from eventos e
inner join detalleeventos de on e.id = de.idevento
inner join plagas p on de.idplaga = p.id
inner join configuraciontrampas ct  on e.idconfiguraciontrampa=ct.id
inner join plantas pl on ct.idplanta = pl.id
where pl.id = 1 and ct.idclasificaiontrampa = 3 and e.fechaevento >='2016-01-04' and e.fechaevento <='2016-02-28'
group by p.name,e.fechaevento 
order by e.fechaevento ASC

--group by de.quantity,p.name 

<commit_msg>comments<commit_after>﻿select * from configuraciontrampas 

insert into eventos (semana,fechaevento,createdby,modifiedby,idconfiguraciontrampa) 
values (2,'2016-01-04','YO','YO',1);

insert into eventos (semana,fechaevento,createdby,modifiedby,idconfiguraciontrampa) 
values (2,'2016-01-04','YO','YO',1);

insert into eventos (semana,fechaevento,createdby,modifiedby,idconfiguraciontrampa) 
values (2,'2016-01-11','YO','YO',2);

select * from eventos 

insert into detalleeventos (quantity,createdby,modifiedby,idevento,idplaga) 
values (4,'YO','YO',1,5);

insert into detalleeventos (quantity,createdby,modifiedby,idevento,idplaga) 
values (4,'YO','YO',2,5);

insert into detalleeventos (quantity,createdby,modifiedby,idevento,idplaga) 
values (2,'YO','YO',1,9);

insert into detalleeventos (quantity,createdby,modifiedby,idevento,idplaga) 
values (6,'YO','YO',3,8);

insert into detalleeventos (quantity,createdby,modifiedby,idevento,idplaga) 
values (6,'YO','YO',3,14);

insert into detalleeventos (quantity,createdby,modifiedby,idevento,idplaga) 
values (6,'YO','YO',4,18);

insert into detalleeventos (quantity,createdby,modifiedby,idevento,idplaga) 
values (6,'YO','YO',4,27);

select * from detalleeventos 


select e.id,pl.name,ct.numerotrampa,e.semana,e.fechaevento,de.quantity,p.name from eventos e
inner join detalleeventos de on e.id = de.idevento
inner join plagas p on de.idplaga = p.id
inner join configuraciontrampas ct  on e.idconfiguraciontrampa=ct.id
inner join plantas pl on ct.idplanta = pl.id


--sumar las plagas, filtar por intervlo de fechas y por planta
-- filtrar por clasificacion tambien
select SUM(de.quantity) as quantity,p.name,e.fechaevento 
from eventos e
inner join detalleeventos de on e.id = de.idevento
inner join plagas p on de.idplaga = p.id
inner join configuraciontrampas ct  on e.idconfiguraciontrampa=ct.id
inner join plantas pl on ct.idplanta = pl.id
where pl.id = 1 and ct.idclasificaiontrampa = 3 and e.fechaevento >='2016-01-04' and e.fechaevento <='2016-02-28'
group by p.name,e.fechaevento 
order by e.fechaevento ASC

--group by de.quantity,p.name 

/*


fields read only
mostrar tipo en form eventos
semana parse to int sin cero ala izq.
mostrar tipo planta en view eventos
quitar observaciones en view eventos
mostrar eventos en view, filtrados por planta selected
fix: ngModel:datefmt] Expected 



*/

{'fraction_non_alphanumeric': 0.1207978484984312, 'fraction_numerical': 0.03227252353204841, 'mean_word_length': 6.538851351351352, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5912498', 'n_tokens_mistral': 1807, 'n_tokens_neox': 1695, 'n_words': 382}