DH-IT-Portal-Development / ethics

Ethical Committee web application in Django
http://fetc.hum.uu.nl
MIT License
2 stars 1 forks source link

fix: create and implement attachment filename generator #725

Open EdoStorm96 opened 4 weeks ago

EdoStorm96 commented 4 weeks ago

So here is a little filename generator. It took me a bit long to figure out, but with some tips from Ty, I got it to work. It did not quite make sense to use the old FilenameFactory, as the filename generator of cdh FileField, expects something different.

So this function just receives the FileWrapper ... From there I search for the relevant ProposalAttachment or StudyAttachment and get the relevant info from there. This is a bit quick and dirty ... But it works for now.

Although there is some overlapping code between this and the FilenameFactory ... they are just different enough, that I thought let's just have them coexsist ... I guess that can be a helper function that removes the overlap, but this does not seem like a huge win to me, both for efficiency, or readability.

I have not though through all the possibilities for attachments resulting in the same filename ... I think I will first start implementing the slots and checkers a bit more, to get a grasp of all the possibilities for things like this to occur ... As a starting point, this is ok imo.

miggol commented 1 week ago

See the way I added an FETC-filename link in the detailed attachments review view (#752) for how I see the filename generator being used