# HG changeset patch # User cavaliet # Date 1357570228 -3600 # Node ID 0eee72ebc2c07c6522840f9f7d774bdd7b198864 # Parent d79a3123f31cfa51ddf8fe8c0aa9a7728b245929 add title sort after weight sort (correction) diff -r d79a3123f31c -r 0eee72ebc2c0 src/ldt/ldt/ldt_utils/views/json.py --- a/src/ldt/ldt/ldt_utils/views/json.py Mon Jan 07 15:37:49 2013 +0100 +++ b/src/ldt/ldt/ldt_utils/views/json.py Mon Jan 07 15:50:28 2013 +0100 @@ -163,12 +163,13 @@ current_weight = 1 # Now that we have the weight for all temporal segments, we just have to sort the array. - highest_weighted = sorted(highest_weighted, key=itemgetter("weight", "title"), reverse=True) + highest_weighted = sorted(highest_weighted, key=lambda x: (-x["weight"],x["title"])) for res in highest_weighted: cur_in = res["start_ts"] cur_out = cur_in + res["duration"] if tc_in<=cur_in and cur_out<=tc_out and ((not remove_zero_dur) or (remove_zero_dur and res["duration"]>0.0)): #mashup_list["items"].append(res["iri_id"] + ", " + res["element_id"] + ", " + str(res["start_ts"]) + ", " + str(res["duration"]) + ", " + str(res["weight"])) + #mashup_list["items"].append(res["element_id"] + ", " + str(res["weight"]) + ", " + res["title"]) mashup_list["items"].append(res["element_id"]) else: # no particular sorting