@autobusal/routes-order 1.31.4 → 1.31.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/Facts/types.ts +7 -0
- package/Sections/Schema.tsx +26 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.31.5
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **BusTrip carries the pair's AggregateRating** when `/routes/search/facts` reports one (`FactsData.rating`). The aggregate is computed server-side over the same published-review rules the reviews listing uses, and rides the facts cache - the pair page keeps its one-fetch design. Absent rating, the key is not emitted at all.
|
|
8
|
+
|
|
3
9
|
## 1.31.4
|
|
4
10
|
|
|
5
11
|
### Fixed
|
package/Facts/types.ts
CHANGED
|
@@ -17,6 +17,13 @@ export interface FactsData {
|
|
|
17
17
|
// how many coaches serve the pair in the TIMETABLE, not on a given date
|
|
18
18
|
departures: number
|
|
19
19
|
operators: string[]
|
|
20
|
+
// Edited: Claude - Date: 2026-08-20
|
|
21
|
+
// The pair's own review score - the published reviews of every route in
|
|
22
|
+
// this very timetable, aggregated by obtapi with the same threshold rule
|
|
23
|
+
// as everything else (null until there is enough to say something honest).
|
|
24
|
+
// For structured data; note ScheduleRow.rating below is the OPERATOR's
|
|
25
|
+
// company-wide number, a different thing.
|
|
26
|
+
rating: { average: number, count: number } | null
|
|
20
27
|
// Two numbers that must never be conflated.
|
|
21
28
|
//
|
|
22
29
|
// `road` is real driving distance from a routing service and is null unless
|
package/Sections/Schema.tsx
CHANGED
|
@@ -27,6 +27,19 @@ interface Props {
|
|
|
27
27
|
* claiming travellers rated this journey when they rated the company. When
|
|
28
28
|
* an operator has no published rating - below the display threshold - it is
|
|
29
29
|
* simply absent, exactly as it is on the page.
|
|
30
|
+
*
|
|
31
|
+
* Edited: Claude - Date: 2026-08-20
|
|
32
|
+
*
|
|
33
|
+
* The trip now ALSO carries its own AggregateRating - and that is not the
|
|
34
|
+
* claim the paragraph above forbids, because `facts.rating` is a different
|
|
35
|
+
* number: obtapi aggregates the published reviews of exactly the routes in
|
|
36
|
+
* this timetable (Facts::rating, the same set Reviews\BrowseController's
|
|
37
|
+
* `pair` mode reads), not a company-wide score stretched over one leg.
|
|
38
|
+
* Travellers who booked these very coaches wrote those reviews, and every
|
|
39
|
+
* card on the page links to the operator profile where they are read in
|
|
40
|
+
* full. Below the display threshold obtapi sends null and nothing is
|
|
41
|
+
* emitted here - an AggregateRating of nothing is a guideline violation,
|
|
42
|
+
* worse than none.
|
|
30
43
|
*/
|
|
31
44
|
const Schema = ({ facts, t }: Props): (JSX.Element | null) => {
|
|
32
45
|
const schedule = facts.schedule ?? [];
|
|
@@ -62,6 +75,19 @@ const Schema = ({ facts, t }: Props): (JSX.Element | null) => {
|
|
|
62
75
|
departureBusStop: { '@type': 'BusStop', name: facts.from },
|
|
63
76
|
arrivalBusStop: { '@type': 'BusStop', name: facts.to },
|
|
64
77
|
|
|
78
|
+
// Edited: Claude - Date: 2026-08-20
|
|
79
|
+
// The pair's own score - see the header comment. Null below the
|
|
80
|
+
// display threshold, and then the property simply does not exist.
|
|
81
|
+
...(facts.rating ? {
|
|
82
|
+
aggregateRating: {
|
|
83
|
+
'@type': 'AggregateRating',
|
|
84
|
+
ratingValue: facts.rating.average,
|
|
85
|
+
reviewCount: facts.rating.count,
|
|
86
|
+
bestRating: 5,
|
|
87
|
+
worstRating: 1
|
|
88
|
+
}
|
|
89
|
+
} : {}),
|
|
90
|
+
|
|
65
91
|
...(providers.length > 0 ? {
|
|
66
92
|
provider: providers.map(item => organisation(item.name, item.rating))
|
|
67
93
|
} : {}),
|