Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
lluisd committed Feb 1, 2024
1 parent 4f3e885 commit 0960e6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ Information from weather comes from AEMET OpenData to get Spain weather predicti
```

## Train
Find next departure time of the train from a given origin and destination. It uses the renfe open datasets (https://data.renfe.com/)
Find next departure time of the train from a given origin and destination. It uses the renfe GTFS dataset improved_gtfs.zip (https://gtfs.pro/en/spain/Renfe-Operadora/renfe)

### commands

```javascript
!md girona figueres
!md girona, sant celoni
//result: Próximo tren MD de Girona a Sant Celoni sale a las 14:49:00
```

```javascript
!ave girona sants
!ave girona, sants
//result:
```
6 changes: 4 additions & 2 deletions helpers/sqlManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ async function getCloserFutureTrain (origin, destination, type) {
try {
this.pool = await sql.connect(config.sql.connectionString)
const request = this.pool.request()
const result = await request.query(`SELECT TOP 1 CONVERT(VARCHAR(8),A.departure_time, 108) time , A.stop_name origin_stop, B.stop_name destination_stop FROM
const result = await request.query(`SELECT TOP 1 CONVERT(VARCHAR(8),A.departure_time, 108) time , A.stop_name origin_stop, B.stop_name destination_stop FROM
(SELECT ST.trip_id , S.stop_name, ST.stop_id, ST.stop_sequence, ST.departure_time
from stop_times ST
inner join stops S ON S.stop_id = ST.stop_id
Expand Down Expand Up @@ -39,7 +39,9 @@ where CD.date = DATEADD(hour, 1, GETDATE()) )
ORDER BY ABS( DATEDIFF(minute, A.departure_time, CONVERT (time, DATEADD(hour, 1, GETDATE()))) )`)
return result.recordset[0]
} catch (err) {}
} catch (err) {
console.log(err)
}
}

module.exports = {
Expand Down

0 comments on commit 0960e6e

Please sign in to comment.