@pocketprep/types 1.19.31 → 1.19.32

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/Study/Class.d.ts CHANGED
@@ -940,6 +940,49 @@ export type AggregateStats = Parse.Object<{
940
940
  export type AggregateStatsPayload = Payload<AggregateStats>
941
941
  export type AggregateStatsJSON = ReturnType<AggregateStats['toJSON']>
942
942
 
943
+ export type LatestAnswerBySerial = { [serial: string]: boolean }
944
+
945
+ export type SubjectStudyStats = {
946
+ subjectId: string
947
+ name: string
948
+ totalAnswersCount: number
949
+ totalCorrectAnswersCount: number
950
+ averageScore: number
951
+ }
952
+
953
+ /**
954
+ * The stats calculated from a user's accumulated answers and the exam's question bank
955
+ */
956
+ export type ComputedStudyStats = {
957
+ totalAnswersCount: number
958
+ totalCorrectAnswersCount: number
959
+ averageScore: number
960
+ totalQuizzesCount: number // Excludes QotD and Mock Exams
961
+ daysStudyingCount: number
962
+ studyingDurationSeconds: number // Excludes Mock Exams
963
+ subjectStats: SubjectStudyStats[]
964
+ unansweredCount: {
965
+ premium: number
966
+ free: number
967
+ }
968
+ }
969
+
970
+ /**
971
+ * A user's study stats for one exam version, one document per user per version.
972
+ */
973
+ export type StudyStats = Parse.Object<{
974
+ user: User | Parse.Pointer
975
+ examMetadata: ExamMetadata | Parse.Pointer
976
+ latestAnswerBySerial: LatestAnswerBySerial
977
+ quizCount: number // Excludes QotD and Mock Exams
978
+ studyDays: string[]
979
+ durationSeconds: number // Excludes Mock Exams
980
+ studyStats: ComputedStudyStats
981
+ }>
982
+
983
+ export type StudyStatsPayload = Payload<StudyStats>
984
+ export type StudyStatsJSON = ReturnType<StudyStats['toJSON']>
985
+
943
986
  export type PrebuiltQuiz = Parse.Object<{
944
987
  name: string
945
988
  questionSerials: string[]
package/Study/Cloud.d.ts CHANGED
@@ -33,6 +33,7 @@ import {
33
33
  ConceptQuizJSON,
34
34
  QuizJSON,
35
35
  CrossPlatformConfig,
36
+ ComputedStudyStats,
36
37
  } from './Class'
37
38
 
38
39
  // DEPRECATED - previously used answer package for a quiz or qotd
@@ -106,6 +107,17 @@ export interface IRecordQuizPayload {
106
107
  includeRecommendedNext?: boolean
107
108
  includeReadiness?: boolean
108
109
  includeConceptQuiz?: boolean
110
+ includeStudyStats?: boolean
111
+ }
112
+
113
+ /**
114
+ * The study stats a client renders on its stats page.
115
+ * Calculated on the server so that all clients show the same values.
116
+ */
117
+ export type TStudyStats = Omit<ComputedStudyStats, 'unansweredCount'> & {
118
+ totalUnansweredCount: number
119
+ examCommunityAverage: number
120
+ weakestSubjectId?: string
109
121
  }
110
122
 
111
123
  export type TLevelUpProgress = NonNullable<UserExamMetadataJSON['levelUpProgress']>
@@ -193,6 +205,7 @@ export type recordQuizV2 = (
193
205
  }
194
206
  tip: RecommendationTip | null
195
207
  recommendedNext: Recommendation | null
208
+ studyStats?: TStudyStats
196
209
  }
197
210
 
198
211
  export type recordQuizAnswers = (params: {
@@ -442,9 +455,11 @@ export type fetchUserDataV2 = (params: {
442
455
  lastFetchedAt?: string // ISO8901 date string
443
456
  version?: string
444
457
  includeQuestionMetrics?: boolean
458
+ includeStudyStats?: boolean
445
459
  }) => {
446
460
  quizzes: QuizJSON[]
447
461
  subscriptions: Subscription[]
462
+ studyStats?: TStudyStats
448
463
  user: User
449
464
  userExamMetadata: UserExamMetadata | undefined
450
465
  referralInfo: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/types",
3
- "version": "1.19.31",
3
+ "version": "1.19.32",
4
4
  "description": "Pocket Prep type declarations",
5
5
  "repository": {
6
6
  "type": "git",