gatsby-core-theme 6.1.8 → 6.1.9
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
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## [6.1.9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.8...v6.1.9) (2022-04-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add getRoundMinutes function in gatsby theme ([e74c629](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e74c62918852b7ee9fe304fc8c6b633e75e543a9))
|
|
7
|
+
* add getRoundMinutes function in getters and testes && updated the project with git pull ([5b61f4b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5b61f4b0b912b4be7eee3eb9dbb9b2ad42b66bd9))
|
|
8
|
+
* added new field in toplist keys ([fbe30a9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fbe30a9072c58022b914c1e0c21a4652dce6e557))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
* Merge branch 'tm-2814-launch-date' into 'master' ([0c48e60](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0c48e601a1364155b84727eab3c8781493528ae7))
|
|
12
|
+
* Merge branch 'tm-2832-fix-time-to-read-in-OG' into 'master' ([6792364](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/67923641c04f38e10a514e93b4db7bcd8140fac9))
|
|
13
|
+
|
|
1
14
|
## [6.1.8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.7...v6.1.8) (2022-04-26)
|
|
2
15
|
|
|
3
16
|
|
package/package.json
CHANGED
package/src/helpers/getters.js
CHANGED
|
@@ -362,3 +362,9 @@ export function shiftFirstOperator(pageId, module, pagesMappedById) {
|
|
|
362
362
|
pagesMappedById[pageId] && module.items.unshift(pagesMappedById[pageId]);
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
+
|
|
366
|
+
export const getRoundMinutes = (time) => {
|
|
367
|
+
const [minutes, seconds] = time.split(':');
|
|
368
|
+
const value = seconds > 30 ? Number(minutes) + 1 : Number(minutes);
|
|
369
|
+
return value === 0 ? 1 : value;
|
|
370
|
+
};
|
|
@@ -253,4 +253,11 @@ describe('Getters Helper', () => {
|
|
|
253
253
|
Getters.shiftFirstOperator(13212, module, pagesMappedById);
|
|
254
254
|
expect(module.items[0].id).toBe(13212);
|
|
255
255
|
});
|
|
256
|
+
|
|
257
|
+
test('If the reading time is bigger than half, it should return the next number ', () => {
|
|
258
|
+
expect(Getters.getRoundMinutes('3:52')).toBe(4);
|
|
259
|
+
});
|
|
260
|
+
test('If reading time is less than half, it should return the last number ', () => {
|
|
261
|
+
expect(Getters.getRoundMinutes('3:29')).toBe(3);
|
|
262
|
+
});
|
|
256
263
|
});
|
|
@@ -15,6 +15,7 @@ import { shouldSavePrefilled, processModule } from './modules';
|
|
|
15
15
|
import { clonePageForCards, groupBy, removeTags } from './common';
|
|
16
16
|
import { prepareSportsData, addSportsDataToPage, addExtraFieldsToShowcaseEvents } from './sports';
|
|
17
17
|
import { zeroPadding } from '../schedule';
|
|
18
|
+
import { getRoundMinutes } from '../getters';
|
|
18
19
|
|
|
19
20
|
const previewMode = process.env.GATSBY_PREVIEW_MODE || false;
|
|
20
21
|
const postSectionsMap = {
|
|
@@ -135,7 +136,7 @@ export function processSections(sections, skipPost = false, page) {
|
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
if (page) {
|
|
138
|
-
page.reading_time = `${zeroPadding(minutes, 2)}:${zeroPadding(seconds, 2)}
|
|
139
|
+
page.reading_time = getRoundMinutes(`${zeroPadding(minutes, 2)}:${zeroPadding(seconds, 2)}`);
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
return sections;
|