noi-techpark / it.bz.beacon.api

This repository contains the sourcecode of the administration web-app that allows to manage the beacon network installed withing the Beacon Suedtirol project.
Other
1 stars 3 forks source link

As a Beacon Manager I want that the infromation of the beacon are regularly updated in order to show the right content during the event of the 24th and 25th September. #40

Closed sseppi closed 4 years ago

sseppi commented 5 years ago

The API backend should regularly syncronize with the following spreadsheet

https://docs.google.com/spreadsheets/d/13ddjs6puWyAPTqaVVo2QKQ0-E6-EQBwfIkYyv1jxN2Q

Actually the syncronization seems not work since the new information updated in the spreadsheed aren't shown by the Beacon API.

For example the API for the beacon with ID = QOPvgN returns the following GPS coordinates 46.5035208, 11.3504809 and in the spreadhseet the coordinates are 46.5036700, 11.3502610.

bertolla commented 5 years ago

Checked log files and found this:

2019-09-20 06:34:42.978 ERROR 12243 --- [-8080-exec-9021] o.s.b.w.servlet.support.ErrorPageFilter  : Forwarding to error page from request [/v1/infos/eddystone/6c0fa7c155ab] due to exception [query did not return a unique result: 2; nested exception is javax.persistence.NonUniqueResultException: query did not return a unique result: 2]

I've checked db and it really seems to be a duplicated key:

beacon=> select instance_id,count(*) from info group by instance_id order by count(*) desc;

 instance_id  | count 
--------------+-------
 6c0fa7c155ab |     2
 86ab625487e9 |     1
 54ab923bff7b |     1
 d5d7d08ebecc |     1
 8c07407c7b81 |     1
 e7d36bb3468e |     1

@raiffeisennet I would suggest to make the column unique to avoid this behaviour in the future. Does somebody know how this happened and how we can avoid this?

bertolla commented 5 years ago

By checking the log file further I also found this Error msg:

2019-09-20 04:26:21.627  INFO 12243 --- [   scheduling-1] i.b.b.a.s.i.InfoReplicationTask          : Starting sheet import...
2019-09-20 04:26:25.672 ERROR 12243 --- [   scheduling-1] i.b.b.a.s.i.InfoReplicationTask          : An unexcpected error occurred: For input string: "ZoneID"
bertolla commented 5 years ago

More infos about the duplicate entry:

   id   |       created_at        |       updated_at        |      address       |  cap  | latitude  | location | longitude | floor | instance_id  | major | minor |           name           |      namespace       |                 uuid                 |                      website                       
--------+-------------------------+-------------------------+--------------------+-------+-----------+----------+-----------+-------+--------------+-------+-------+--------------------------+----------------------+--------------------------------------+----------------------------------------------------
 TnpUot | 2019-03-21 08:12:10.84  | 2019-03-21 08:12:10.84  | Hans-Feur-Straße 4 | 39040 | 46.341854 | Tramin   | 11.240533 |       | 6c0fa7c155ab | 38961 | 24138 | Weingut A. von Elzenbaum | 6a84c7166a63bd873dd9 | 6a84c716-0f2a-1ce9-f210-6a63bd873dd9 | https://www.tramin.com/de/betrieb/a-von-elzenbaum/
 e6yG5M | 2019-03-21 08:12:06.786 | 2019-09-09 16:21:47.455 |                    |       |         0 |          |         0 |       | 6c0fa7c155ab | 38961 | 24138 | TRA0009 FREI             | 6a84c7166a63bd873dd9 | 6a84c716-0f2a-1ce9-f210-6a63bd873dd9 | 
(2 rows)
sseppi commented 4 years ago

Hi Patrick, i seems that @raiffeisennet during the installation changed a broken beacon and during the change something went wrong.

@raiffeisennet can you solve the problem together with @bertolla till monday afternoon?

raiffeisennet commented 4 years ago

By checking the log file further I also found this Error msg:

2019-09-20 04:26:21.627  INFO 12243 --- [   scheduling-1] i.b.b.a.s.i.InfoReplicationTask          : Starting sheet import...
2019-09-20 04:26:25.672 ERROR 12243 --- [   scheduling-1] i.b.b.a.s.i.InfoReplicationTask          : An unexcpected error occurred: For input string: "ZoneID"

Removed unused, empty, unparseable table sheets "Tabellenblatt 14" and "Tabellenblatt 15" from google sheet.

raiffeisennet commented 4 years ago

More infos about the duplicate entry:

   id   |       created_at        |       updated_at        |      address       |  cap  | latitude  | location | longitude | floor | instance_id  | major | minor |           name           |      namespace       |                 uuid                 |                      website                       
--------+-------------------------+-------------------------+--------------------+-------+-----------+----------+-----------+-------+--------------+-------+-------+--------------------------+----------------------+--------------------------------------+----------------------------------------------------
 TnpUot | 2019-03-21 08:12:10.84  | 2019-03-21 08:12:10.84  | Hans-Feur-Straße 4 | 39040 | 46.341854 | Tramin   | 11.240533 |       | 6c0fa7c155ab | 38961 | 24138 | Weingut A. von Elzenbaum | 6a84c7166a63bd873dd9 | 6a84c716-0f2a-1ce9-f210-6a63bd873dd9 | https://www.tramin.com/de/betrieb/a-von-elzenbaum/
 e6yG5M | 2019-03-21 08:12:06.786 | 2019-09-09 16:21:47.455 |                    |       |         0 |          |         0 |       | 6c0fa7c155ab | 38961 | 24138 | TRA0009 FREI             | 6a84c7166a63bd873dd9 | 6a84c716-0f2a-1ce9-f210-6a63bd873dd9 | 
(2 rows)

Please remove the entry from beacon_data and info db tables where the beacon id is TnpUot, this should resolve the problem for now. I will advise our installation team to not duplicate major/minor and instanceId on beacon replacement.

bertolla commented 4 years ago

Ok done, I also had to delete the row from table order_data (foreign key)

bertolla commented 4 years ago

@sseppi Last sync at half past 12 still gave

2019-09-23 10:27:18.318  INFO 12243 --- [   scheduling-1] i.b.b.a.s.i.InfoReplicationTask          : Starting sheet import...
2019-09-23 10:27:18.868 ERROR 12243 --- [   scheduling-1] i.b.b.a.s.i.InfoReplicationTask          : An unexcpected error occurred: For input string: "ZoneID"

Is the sync working for you as intended? Furthermore at 13:53 also this happened:

2019-09-23 11:53:10.385 ERROR 12243 --- [-8080-exec-9248] o.s.b.w.servlet.support.ErrorPageFilter  : Forwarding to error page from request [/v1/admin/beacons/qaebc5/images] due to exception [Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. java.net.SocketTimeoutException]

Do you want to open a new issue?

sseppi commented 4 years ago

Nope, the import didn't worked as expected. The API still returns the wrong data.

@raiffeisennet did it worked in your development environment? Can you chek why this is still not working?

raiffeisennet commented 4 years ago

Could you retry please? I fixed the first sheet, named "Zones"

bertolla commented 4 years ago

I did so, the error is gone and when Stefano S. confirms successfull sync I will close this issue