Commit db28e50b authored by Roberto Bochet's avatar Roberto Bochet

Ruby use a terrible way to order date

parent 71c7471e
Pipeline #428 passed with stage
in 1 minute and 28 seconds
......@@ -24,7 +24,10 @@ module Jekyll
editions = get_course_editions(site, page.data["course"]["slug"])
# set last course edition
page.data["course"]["edition"] = editions.pop
page.data["course"]["edition"] = editions.first
# remove last editions
editions = editions.drop(1)
# set past editions check
page.data["course"]["has_past_editions"] = editions.size > 0
......@@ -44,7 +47,7 @@ module Jekyll
def get_course_editions(site, slug)
editions = site.data["courses"].values
editions = editions.select { |obj| obj["course"] == slug }
editions.sort! { |a,b| a["date"] <=> b["date"] }
editions.sort! { |b,a| a["date"] <=> b["date"] }
editions.map { |obj| parse_edition_data(obj) }
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment