Skip to content

Commit 970e016

Browse files
committed
Merge branch 'release-v0.4.x' into release-v0.5.x
# Conflicts: # kolibri/core/assets/src/state/actions.js # kolibri/plugins/learn/assets/src/views/assessment-wrapper/index.vue # kolibri/plugins/user/assets/src/views/sign-in-page/index.vue
2 parents 5d5ed98 + 760decf commit 970e016

File tree

3 files changed

+39
-16
lines changed

3 files changed

+39
-16
lines changed

kolibri/core/assets/src/state/actions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import { redirectBrowser } from '../utils/browser';
2121

2222
const logging = logger.getLogger(__filename);
2323
const intervalTime = 5000; // Frequency at which time logging is updated
24-
const progressThreshold = 0.1; // Update logs if user has reached 20% more progress
25-
const timeThreshold = 30; // Update logs if 30 seconds have passed since last update
24+
const progressThreshold = 0.25; // Update logs if user has reached 25% more progress
25+
const timeThreshold = 60; // Update logs if 60 seconds have passed since last update
2626

2727
/**
2828
* Vuex State Mappers

kolibri/plugins/learn/assets/src/views/assessment-wrapper/index.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,17 @@ oriented data synchronization.
215215
simpleAnswer,
216216
firstAttempt: true,
217217
});
218+
// Save attempt log on first attempt
219+
this.saveAttemptLogMasterLog();
218220
} else {
219-
this.updateAttemptLogMasteryLog({ complete: this.complete });
221+
this.updateAttemptLogMasteryLog({
222+
complete: this.complete,
223+
});
224+
if (this.complete) {
225+
// Otherwise only save if the attempt is now complete
226+
this.saveAttemptLogMasterLog();
227+
}
220228
}
221-
this.saveAttemptLogMasterLog();
222229
},
223230
hintTaken({ answerState }) {
224231
this.updateAttemptLogInteractionHistoryAction({
@@ -236,8 +243,9 @@ oriented data synchronization.
236243
});
237244
this.firstAttempt = false;
238245
this.onlyHinted = true;
246+
// Only save if this was the first attempt to capture this
247+
this.saveAttemptLogMasterLog();
239248
}
240-
this.saveAttemptLogMasterLog();
241249
},
242250
setItemId() {
243251
const index = this.totalattempts % this.assessmentIds.length;
@@ -308,6 +316,10 @@ oriented data synchronization.
308316
this.$emit('stopTracking', ...args);
309317
},
310318
},
319+
beforeDestroy() {
320+
// Make sure any unsaved data is captured before tear down.
321+
this.saveAttemptLogMasterLog();
322+
},
311323
computed: {
312324
canLogInteractions() {
313325
return !this.isSuperuser && this.isUserLoggedIn;

kolibri/plugins/user/assets/src/views/sign-in-page/index.vue

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,23 @@
166166
});
167167
},
168168
setSuggestionTerm(newVal, oldVal) {
169-
if (newVal.length < 3) {
170-
this.suggestionTerm = '';
171-
this.usernameSuggestions = [];
172-
} else if (
173-
(!newVal.startsWith(this.suggestionTerm) && this.suggestionTerm.length) ||
174-
!this.suggestionTerm.length
175-
) {
176-
this.suggestionTerm = newVal;
177-
this.setSuggestions();
169+
if (newVal !== null && typeof newVal !== 'undefined') {
170+
// Only check if defined or not null
171+
if (newVal.length < 3) {
172+
// Don't search for suggestions if less than 3 characters entered
173+
this.suggestionTerm = '';
174+
this.usernameSuggestions = [];
175+
} else if (
176+
(!newVal.startsWith(this.suggestionTerm) && this.suggestionTerm.length) ||
177+
!this.suggestionTerm.length
178+
) {
179+
// We have already set a suggestion search term
180+
// The currently set suggestion term does not match the current username
181+
// Or we do not currently have a suggestion term set
182+
// Set it to the new term and fetch new suggestions
183+
this.suggestionTerm = newVal;
184+
this.setSuggestions();
185+
}
178186
}
179187
},
180188
setSuggestions() {
@@ -192,8 +200,11 @@
192200
});
193201
},
194202
fillUsername(username) {
195-
this.username = username;
196-
this.showDropdown = false;
203+
// Only do this if we have been passed a non-null value
204+
if (username !== null && typeof username !== 'undefined') {
205+
this.username = username;
206+
this.showDropdown = false;
207+
}
197208
},
198209
},
199210
vuex: {

0 commit comments

Comments
 (0)