match round can be negative
tommy-mor opened this issue · 1 comments
tommy-mor commented
I got this response from match index get request:
[
{
"match": {
"id": 358485473,
"tournament_id": 14250816,
"state": "open",
"player1_id": 226125204,
"player2_id": 226125203,
"player1_prereq_match_id": null,
"player2_prereq_match_id": null,
"player1_is_prereq_match_loser": false,
"player2_is_prereq_match_loser": false,
"winner_id": null,
"loser_id": null,
"started_at": "2024-03-15T12:38:49.140-07:00",
"created_at": "2024-03-15T12:38:49.052-07:00",
"updated_at": "2024-03-15T12:38:49.140-07:00",
"identifier": "A",
"has_attachment": false,
"round": 1,
"player1_votes": null,
"player2_votes": null,
"group_id": null,
"attachment_count": null,
"scheduled_time": null,
"location": null,
"underway_at": null,
"optional": false,
"rushb_id": null,
"completed_at": null,
"suggested_play_order": 1,
"forfeited": null,
"open_graph_image_file_name": null,
"open_graph_image_content_type": null,
"open_graph_image_file_size": null,
"prerequisite_match_ids_csv": "",
"scores_csv": ""
}
},
{
"match": {
"id": 358485474,
"tournament_id": 14250816,
"state": "pending",
"player1_id": 226125205,
"player2_id": null,
"player1_prereq_match_id": null,
"player2_prereq_match_id": 358485473,
"player1_is_prereq_match_loser": false,
"player2_is_prereq_match_loser": false,
"winner_id": null,
"loser_id": null,
"started_at": null,
"created_at": "2024-03-15T12:38:49.057-07:00",
"updated_at": "2024-03-15T12:38:49.057-07:00",
"identifier": "B",
"has_attachment": false,
"round": 2,
"player1_votes": null,
"player2_votes": null,
"group_id": null,
"attachment_count": null,
"scheduled_time": null,
"location": null,
"underway_at": null,
"optional": false,
"rushb_id": null,
"completed_at": null,
"suggested_play_order": 2,
"forfeited": null,
"open_graph_image_file_name": null,
"open_graph_image_content_type": null,
"open_graph_image_file_size": null,
"prerequisite_match_ids_csv": "358485473",
"scores_csv": ""
}
},
{
"match": {
"id": 358485475,
"tournament_id": 14250816,
"state": "pending",
"player1_id": null,
"player2_id": null,
"player1_prereq_match_id": 358485474,
"player2_prereq_match_id": 358485473,
"player1_is_prereq_match_loser": true,
"player2_is_prereq_match_loser": true,
"winner_id": null,
"loser_id": null,
"started_at": null,
"created_at": "2024-03-15T12:38:49.063-07:00",
"updated_at": "2024-03-15T12:38:49.063-07:00",
"identifier": "E",
"has_attachment": false,
"round": -1,
"player1_votes": null,
"player2_votes": null,
"group_id": null,
"attachment_count": null,
"scheduled_time": null,
"location": null,
"underway_at": null,
"optional": false,
"rushb_id": null,
"completed_at": null,
"suggested_play_order": 3,
"forfeited": null,
"open_graph_image_file_name": null,
"open_graph_image_content_type": null,
"open_graph_image_file_size": null,
"prerequisite_match_ids_csv": "358485474,358485473",
"scores_csv": ""
}
},
{
"match": {
"id": 358485476,
"tournament_id": 14250816,
"state": "pending",
"player1_id": null,
"player2_id": null,
"player1_prereq_match_id": 358485474,
"player2_prereq_match_id": 358485475,
"player1_is_prereq_match_loser": false,
"player2_is_prereq_match_loser": false,
"winner_id": null,
"loser_id": null,
"started_at": null,
"created_at": "2024-03-15T12:38:49.070-07:00",
"updated_at": "2024-03-15T12:38:49.070-07:00",
"identifier": "C",
"has_attachment": false,
"round": 3,
"player1_votes": null,
"player2_votes": null,
"group_id": null,
"attachment_count": null,
"scheduled_time": null,
"location": null,
"underway_at": null,
"optional": false,
"rushb_id": null,
"completed_at": null,
"suggested_play_order": 4,
"forfeited": null,
"open_graph_image_file_name": null,
"open_graph_image_content_type": null,
"open_graph_image_file_size": null,
"prerequisite_match_ids_csv": "358485474,358485475",
"scores_csv": ""
}
},
{
"match": {
"id": 358485477,
"tournament_id": 14250816,
"state": "pending",
"player1_id": null,
"player2_id": null,
"player1_prereq_match_id": 358485476,
"player2_prereq_match_id": 358485476,
"player1_is_prereq_match_loser": false,
"player2_is_prereq_match_loser": true,
"winner_id": null,
"loser_id": null,
"started_at": null,
"created_at": "2024-03-15T12:38:49.076-07:00",
"updated_at": "2024-03-15T12:38:49.076-07:00",
"identifier": "D",
"has_attachment": false,
"round": 3,
"player1_votes": null,
"player2_votes": null,
"group_id": null,
"attachment_count": null,
"scheduled_time": null,
"location": null,
"underway_at": null,
"optional": false,
"rushb_id": null,
"completed_at": null,
"suggested_play_order": 5,
"forfeited": null,
"open_graph_image_file_name": null,
"open_graph_image_content_type": null,
"open_graph_image_file_size": null,
"prerequisite_match_ids_csv": "358485476",
"scores_csv": ""
}
}
]
however, it is stored in a struct with u64: https://github.com/iddm/challonge-rs/blob/7262d145d7f7fafe2ca7d57c5e86927d179e9da9/src/matches.rs#L223C1-L225C20
this causes a crash
thread 'main' panicked at /Users/tommy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/challonge-0.5.4/src/matches.rs:280:55:
called `Option::unwrap()` on a `None` value
iddm commented
Thank you for reporting the issue! I certainly didn't expect the round to be negative. Should be easily fixable though! Just need to change the type in the struct, I think. I'll check tomorrow.