cedadev / ceda-fedcheck

ESGF federation check code repository
GNU General Public License v3.0
0 stars 1 forks source link

Does the code need to find the date twice? #2

Open agstephens opened 7 years ago

agstephens commented 7 years ago

Does this piece of code need to exist?

                    dest_file_var = dest_file.split('/')[16]
                    dest_file_year = int(dest_file_var.split('_')[1].strip()[:4])
                    dest_file_mon = int(dest_file_var.split('_')[1].strip()[4:6])
                    dest_file_day = int(dest_file_var.split('_')[1].strip()[6:])
                    symlink_version = datetime.datetime(dest_file_year, dest_file_mon, dest_file_day)

I think we have already calculated the date so we shouldn't need to re-calculate it - or am I confused? :-)

RuthPetrie commented 7 years ago

I think we need two dates the date of the existing version and the date of the current one to compare to work out which is the "latest" - or perhaps I am confused as the code is still not doing /latest correctly. I have modified the code in any case to be more pythonic.