Skip to content

Commit da02b1f

Browse files
sharvaniharanSharvani Haran
andauthored
Update timer logic (#3925)
Co-authored-by: Sharvani Haran <[email protected]>
1 parent 696a0ba commit da02b1f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

app/src/main/java/org/wikipedia/analytics/eventplatform/MachineGeneratedArticleDescriptionsAnalyticsHelper.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ class MachineGeneratedArticleDescriptionsAnalyticsHelper {
1616
var displayOrderList = emptyList<String>()
1717
private var chosenSuggestion = ""
1818
private var startTime = 0L
19-
19+
private var timeSpentPerEdit = 0L
2020
fun articleDescriptionEditingStart(context: Context) {
2121
log(context, composeGroupString() + ".start")
22+
resetTimer()
2223
}
2324

24-
fun resetTimer() {
25+
private fun resetTimer() {
2526
startTime = System.currentTimeMillis()
2627
}
2728

2829
fun articleDescriptionEditingEnd(context: Context) {
29-
log(context, composeGroupString() + ".end.timeSpentMs.${System.currentTimeMillis() - startTime}")
30+
log(context, composeGroupString() + ".end")
31+
timeSpentPerEdit = System.currentTimeMillis() - startTime
3032
}
3133

3234
fun logAttempt(context: Context, finalDescription: String, wasChosen: Boolean, wasModified: Boolean, title: PageTitle) {
@@ -38,7 +40,7 @@ class MachineGeneratedArticleDescriptionsAnalyticsHelper {
3840
fun logSuccess(context: Context, finalDescription: String, wasChosen: Boolean, wasModified: Boolean, title: PageTitle, revId: Long) {
3941
log(context, composeLogString(title) + ".success:$finalDescription" +
4042
".suggestion1:${encode(apiOrderList.first())}" + (if (apiOrderList.size > 1) ".suggestion2.${encode(apiOrderList.last())}" else "") +
41-
getOrderString(wasChosen, chosenSuggestion) + ".modified:$wasModified.revId:$revId")
43+
getOrderString(wasChosen, chosenSuggestion) + ".modified:$wasModified.timeSpentMs.$timeSpentPerEdit.revId:$revId")
4244
}
4345

4446
fun logSuggestionsReceived(context: Context, isBlp: Boolean, title: PageTitle) {

app/src/main/java/org/wikipedia/descriptions/DescriptionEditFragment.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ class DescriptionEditFragment : Fragment() {
195195

196196
private fun setUpEditView(savedInstanceState: Bundle?) {
197197
if (action == DescriptionEditActivity.Action.ADD_DESCRIPTION) {
198-
analyticsHelper.resetTimer()
199198
analyticsHelper.articleDescriptionEditingStart(requireContext())
200199
}
201200
binding.fragmentDescriptionEditView.setAction(action)

0 commit comments

Comments
 (0)