This repository was archived by the owner on Jul 22, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +21
-15
lines changed
Expand file tree Collapse file tree 4 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -56,20 +56,23 @@ function load(station) {
5656
5757 if ( liveboard . departures . departure [ i ] . hasOwnProperty ( "alerts" ) ) { // Detect if we have alerts in this data
5858 for ( var j = 0 ; j < Object . keys ( liveboard . departures . departure [ i ] . alerts . alert ) . length ; j ++ ) {
59- alertsModel . append ( {
60- "header" : liveboard . departures . departure [ i ] . alerts . alert [ j ] . header ,
61- "description" : liveboard . departures . departure [ i ] . alerts . alert [ j ] . description
62- } ) ;
63- }
64- }
65- }
59+ var newEntry = true ;
60+ for ( var k = 0 ; k < alertsModel . count ; k ++ ) {
61+ if ( alertsModel . count == 0 ) { // Only when we have an entry we should check for duplicates
62+ break ;
63+ }
64+
65+ if ( alertsModel . get ( k ) . header == alertsModel . get ( j ) . header ) {
66+ newEntry = false ;
67+ break ;
68+ }
69+ }
6670
67- // Remove duplicates from AlertsModel if the model is > 1
68- if ( alertsModel . count > 1 ) {
69- for ( var i = 0 ; i < alertsModel . count ; i ++ ) {
70- for ( var j = i ; j < alertsModel . count ; j ++ ) { // Only check for the same elements after the current one
71- if ( alertsModel . get ( i ) . header == alertsModel . get ( j ) . header ) {
72- alertsModel . remove ( j ) ;
71+ if ( newEntry ) {
72+ alertsModel . append ( {
73+ "header" : liveboard . departures . departure [ i ] . alerts . alert [ j ] . header ,
74+ "description" : liveboard . departures . departure [ i ] . alerts . alert [ j ] . description
75+ } ) ;
7376 }
7477 }
7578 }
Original file line number Diff line number Diff line change 88# * date Author's Name <author's email> version-release
99# - Summary of changes
1010
11+ * Mon Jun 06 2017 Dylan Van Assche <dylan.van.assche@protonmail.com.com> 1.1-2
12+ - [MINOR BUGFIX] Remove disturbances duplicates in Liveboard
13+
1114* Mon Jun 06 2017 Dylan Van Assche <dylan.van.assche@protonmail.com.com> 1.1-1
1215- [MINOR BUGFIX] Recovering after a wrong connection in the routeplanner fixed
1316- [MINOR BUGFIX] Liveboard shows information twice fixed
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ Name: harbour-berail
1414%{?qtc_builddir:%define _builddir %qtc_builddir }
1515Summary: BeRail
1616Version: 1.1
17- Release: 1
17+ Release: 2
1818Group: Qt/Qt
1919License: LICENSE
2020URL: http://example.org/
Original file line number Diff line number Diff line change 11Name : harbour-berail
22Summary : BeRail
33Version : 1.1
4- Release : 1
4+ Release : 2
55# The contents of the Group field should be one of the groups listed here:
66# http://gitorious.org/meego-developer-tools/spectacle/blobs/master/data/GROUPS
77Group : Qt/Qt
You can’t perform that action at this time.
0 commit comments