Please do compile any suggestions. It’s (mostly) just a markdown file. If you’re familiar with git/github you could even clone a copy, edit, and make a pull request: https://github.com/wrex/ganbarometer-svelte/blob/v4.0/src/components/Help.svx
Alternately, just cut and paste the markdown bits into an editor and send it to me (rw at pobox.com) and I can make the diff.
I despair if “distilled” is considered too difficult for English speakers learning another language, though. Just wait until they get to filial piety.
Hmm. This is odd. The fix should be included. Are you certain you’re running 4.0.8? (Obviously you are or you wouldn’t see the Help text.) Does it still show 0s no matter how many days of reviews you retrieve?
I think I still have an API key for you so I’ll look into it. Can you cut and paste all the session info and send it to me in the interim?
It only appeared that way. A few releases ago, I added a VERSION string to the gbSettings variable stored in localstorage. Now, whenever I make an incompatible change to the object structure of anything stored locally I update the version. This doesn’t happen every release.
When I first put in the version check, I just reset to defaults if there was a mismatch. This release copies over what I can if the version changed (and just adds anything new).
Re: sessions with single review not getting their duration set to the median.
I’m mystified. I even created a test for this specific case and everything. It’s passing:
Here’s the test itself:
it("sets the duration of single review sessions to the median", async () => {
// median(infinity, 1000, 2000, 3000, 4000, 5000, 30000) === 3500
mockReviewCollection([
mockReview({ reviewData: { created_at: "2019-10-01T00:00:00.000Z" } }), // session with single review
mockReview({ reviewData: { created_at: "2019-10-04T00:00:00.000Z" } }), // 2s duration
mockReview({ reviewData: { created_at: "2019-10-04T00:00:02.000Z" } }), // 1s duration
mockReview({ reviewData: { created_at: "2019-10-04T00:00:03.000Z" } }), // 5s duration
mockReview({ reviewData: { created_at: "2019-10-04T00:00:08.000Z" } }), // 4s duration
mockReview({ reviewData: { created_at: "2019-10-04T00:00:12.000Z" } }), // 3s duration
mockReview({ reviewData: { created_at: "2019-10-04T00:00:15.000Z" } }), // unknown (30s)
]);
const reviews = await getReviews(7);
const sessions = parseSessions(reviews);
expect(sessions.length).toBe(2);
expect(sessions[0].reviews.length).toBe(1);
expect(sessions[0].reviews[0].duration).toBe(3500);
});
It first mocks WKOF to return seven Reviews (a single session of one review, then another session with six reviews).
Then it checks that there are two sessions, that the first first session has a single review, and that the duration of the first session is set to the median value.
Here’s the specific section code that implements the logic (and I’ve verified it’s present in v4.0.8beta):
EDIT: whoops copy/pasted the wrong code. Previous one only set the final review retrieved. Here’s the code that does it for the final review within each session:
export const parseSessions = (reviews: Review[]): Session[] => {
// ... other logic
// Force the duration of the last review in each session to the overall median
sessionSlices.forEach((sess) => {
sess.reviews[sess.reviews.length - 1].duration = median_duration;
});
};
Clearly you’re retrieving more than a single session, so I’m mystified. Let me write another test where it’s the second to last session that has a single review (matching your case exactly).
I can’t imagine how it would affect things, but you mentioned you had to keep changing your settings. Could you tell me what changes you’ve made from the defaults?