我正在使用Challonge API,在查询锦标赛时,每个匹配都返回一个indentifier=AZ.在前26个匹配AA-AZ之后BA-BZ,标识符变为,等等.
拉出单个锦标赛的整个匹配列表并尝试使用.sort_by标识符时,结果按以下顺序排序:
A AA AB AC ... B BA BB BC ... C ...
为了正确显示匹配,他们需要按此顺序:
A B C ... AA AB AC ... BA BB BC ...
我花了一些时间搜索,找不到任何真正简单的方法来实现这一点.我发现的大多数帖子都涉及文件名或编号,我不确定如何将其应用于这种情况.
任何帮助将不胜感激!
编辑
这是一个示例响应:
[{"match":{"created_at":"2013-01-09T23:25:22-05:00","has_attachment":false,"id":8148294,"identifier":"CK","loser_id":null,"player1_id":null,"player1_is_prereq_match_loser":true,"player1_prereq_match_id":8148251,"player1_votes":null,"player2_id":null,"player2_is_prereq_match_loser":false,"player2_prereq_match_id":8148293,"player2_votes":null,"round":-9,"started_at":null,"state":"pending","tournament_id":320424,"updated_at":"2013-01-09T23:25:25-05:00","winner_id":null,"prerequisite_match_ids_csv":"8148251,8148293","scores_csv":""}}
你可以"indentifier":"CK"在里面看到.使用时,.length我一直在使用undefined method 'length'.在我正在使用的控制器中@tournamentlist = tournamentlist.matches.sort...