hitobito / hitobito_pbs

A hitobito wagon defining the organization hierarchy and additional features for Pfadibewegung Schweiz.
Other
24 stars 26 forks source link

Daily job to delete possible unneeded sensitive information from event applications #264

Closed Michael-Schaer closed 6 months ago

Michael-Schaer commented 1 year ago

Die Übersetzung von SQL in Active Record ist noch nicht ganz gelungen.

SQL-Code:


UPDATE event_approvals ea
JOIN event_participations ep ON ep.application_id = ea.application_id
JOIN events e ON ep.event_id = [e.id](http://e.id/)
JOIN event_dates ed ON [e.id](http://e.id/) = ed.event_id
SET ea.comment=NULL, ea.current_occupation=NULL,
ea.current_level=NULL, ea.occupation_assessment=NULL,
ea.strong_points=NULL, ea.weak_points=NULL
WHERE ed.id = (SELECT id FROM event_dates WHERE event_id=ed.event_id ORDER BY finish_at DESC LIMIT 1)
AND e.state = 'closed'
AND ed.finish_at < DATE_SUB(CURDATE(), INTERVAL 90 DAY);

See https://github.com/hitobito/hitobito/issues/1060

kronn commented 6 months ago

Superseeded by #329