Rothamsted-Ecoinformatics / eRA

e-RA website code
3 stars 0 forks source link

_user: add date to the record of registration. #86

Closed nathcast closed 2 years ago

nathcast commented 2 years ago

The date of first registration to the database is not recorded. It would be nice to see when the user first registers and

nathcast commented 2 years ago

To update the user registration with the date of teh earliest download,


-- create the table
CREATE TABLE eraDL
AS
select  position,   MIN(`dl-date`)  dlfirst
from eRAdownloads er 
where position not like '%Anonymous%'
group by position;

-- update with values from that table - had to use trim because there must have been some blanks
UPDATE
    newmarkers
    SET reg_date = (select dlfirst from eraDL where trim(eraDL.`position`) = trim(newmarkers.`position`)) 
;

 -- add an anterior date for all those who never downloaded anything
UPDATE
    newmarkers
    SET reg_date ='2021-03-09' 
    where reg_date is null
;
nathcast commented 2 years ago

Date is now showing on the list of registered users.