Skip to content

Commit 77d1e56

Browse files
committed
profile time formating
1 parent 7a45d72 commit 77d1e56

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src-colladmin/lib/admin_objects.rb

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ def submittable
7777
return false if @ark == LambdaFunctions::Handler.merritt_admin_coll_owners
7878

7979
# Only allow submission for profiles newer than 2 years old
80-
Time.new(@created) > (DateTime.now - (365 * 2)).to_time
80+
Time.parse(@created) > (DateTime.now - (365 * 2)).to_time
81+
rescue
82+
LambdaBase.log("Time issue for #{path}: #{name}")
83+
return false
8184
end
8285

8386
def load_from_json(json)
@@ -204,7 +207,12 @@ def initialize(body, dbmap, artifact)
204207

205208
def parse_profiles(data)
206209
fetch_array_val(data, 'pros:profileFile').each do |json|
207-
p = AdminProfile.new(@artifact).load_from_json(json)
210+
begin
211+
p = AdminProfile.new(@artifact).load_from_json(json)
212+
rescue
213+
LambdaBase.log("SKIP Profile #{json.to_s}")
214+
next
215+
end
208216
next if p.skip
209217

210218
@profiles.push(p)
@@ -225,7 +233,12 @@ def match_profiles(dbmap)
225233
elsif @profile_names.key?(name)
226234
@profile_arks[ark] = @profile_names[name].load_from_db(rec)
227235
else
228-
p = AdminProfile.new(@artifact).load_from_db(rec)
236+
begin
237+
p = AdminProfile.new(@artifact).load_from_db(rec)
238+
rescue
239+
LambdaBase.log("SKIP OBJ:#{name}")
240+
next
241+
end
229242
@profile_arks[ark] = p
230243
@profiles.push(p)
231244
end

0 commit comments

Comments
 (0)