Skip to content

Commit 5e214aa

Browse files
ranaldmiaoveluca93
authored andcommitted
Ranking: Retain selected teams/contestants upon page refresh
1 parent 2c1ce46 commit 5e214aa

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

cmsranking/static/DataStore.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ var DataStore = new function () {
722722
});
723723

724724
self.create_event_source();
725-
self.init_selections();
725+
self.init_callback();
726726
};
727727

728728
self.update_rank = function (u_id, user) {
@@ -786,8 +786,8 @@ var DataStore = new function () {
786786
- they also start an AJAX request and process its data
787787
- when BOTH requests finish init_scores() is called
788788
- it does again an AJAX request and processes its data
789-
- at the end it calls init_ranks() which calls init_selections() which,
790-
in turn, calls init_callback()
789+
- at the end it calls init_ranks() which calls init_callback()
790+
- Subsequently, when TeamStore is initialized, we call init_selections().
791791
*/
792792

793793
self.init = function (callback) {
@@ -1157,8 +1157,6 @@ var DataStore = new function () {
11571157
}
11581158
}
11591159
});
1160-
1161-
self.init_callback();
11621160
};
11631161

11641162
self.set_selected = function (u_id, flag, color_idx) {

cmsranking/static/Ranking.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ $(document).ready(function() {
4040
HistoryStore.init();
4141
UserDetail.init();
4242
TimeView.init();
43-
TeamSearch.init();
43+
TeamSearch.init(function() {
44+
DataStore.init_selections();
45+
});
4446
Overview.init();
4547
Scoreboard.init();
4648
});

cmsranking/static/TeamSearch.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
var TeamSearch = new function () {
1919
var self = this;
2020

21-
self.init = function () {
21+
self.init = function (callback) {
2222
$("#TeamSearch_input").focus(function () {
2323
self.show();
2424
});
@@ -98,6 +98,7 @@ var TeamSearch = new function () {
9898
self.update();
9999

100100
DataStore.select_events.add(self.select_handler);
101+
callback();
101102
};
102103

103104
self.generate = function () {

0 commit comments

Comments
 (0)