projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
3036: API server tests pass
[arvados.git]
/
services
/
api
/
app
/
models
/
collection.rb
diff --git
a/services/api/app/models/collection.rb
b/services/api/app/models/collection.rb
index f7d9fe8c2a2475e833e3e8efd7a89fd14433340e..2bf781013bce167ae1a376740ad100cb1c73abf9 100644
(file)
--- a/
services/api/app/models/collection.rb
+++ b/
services/api/app/models/collection.rb
@@
-161,13
+161,18
@@
class Collection < ArvadosModel
# that looks like a Docker image, return it.
if loc = Locator.parse(search_term)
loc.strip_hints!
# that looks like a Docker image, return it.
if loc = Locator.parse(search_term)
loc.strip_hints!
- coll_match = readable_by(*readers).where(portable_data_hash: loc.to_s).first
+ coll_match = readable_by(*readers).where(portable_data_hash: loc.to_s).
limit(1).
first
if coll_match and (coll_match.files.size == 1) and
(coll_match.files[0][1] =~ /^[0-9A-Fa-f]{64}\.tar$/)
if coll_match and (coll_match.files.size == 1) and
(coll_match.files[0][1] =~ /^[0-9A-Fa-f]{64}\.tar$/)
- return [
find_by_portable_data_hash(loc.to_s)
.uuid]
+ return [
coll_match
.uuid]
end
end
end
end
+ if search_tag.nil? and (n = search_term.index(":"))
+ search_tag = search_term[n+1..-1]
+ search_term = search_term[0..n-1]
+ end
+
# Find Collections with matching Docker image repository+tag pairs.
matches = base_search.
where(link_class: "docker_image_repo+tag",
# Find Collections with matching Docker image repository+tag pairs.
matches = base_search.
where(link_class: "docker_image_repo+tag",
@@
-185,7
+190,8
@@
class Collection < ArvadosModel
# anything without; then we use the link's created_at as a tiebreaker.
uuid_timestamps = {}
matches.find_each do |link|
# anything without; then we use the link's created_at as a tiebreaker.
uuid_timestamps = {}
matches.find_each do |link|
- uuid_timestamps[link.head_uuid] =
+ c = Collection.find_by_uuid(link.head_uuid)
+ uuid_timestamps[c.uuid] =
[(-link.properties["image_timestamp"].to_datetime.to_i rescue 0),
-link.created_at.to_i]
end
[(-link.properties["image_timestamp"].to_datetime.to_i rescue 0),
-link.created_at.to_i]
end