File tree Expand file tree Collapse file tree 4 files changed +42
-0
lines changed
qasdk/src/main/java/co/astrnt/qasdk Expand file tree Collapse file tree 4 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -103,4 +103,9 @@ interface ApiService {
103103 @POST(" v2/question/last_seen" )
104104 fun addLastSeen (@Header(" token" ) token : String ,
105105 @FieldMap data : HashMap <String , String ?>): Observable <BaseApiDao >
106+
107+ @FormUrlEncoded
108+ @POST(" v2/media/ready-answer" )
109+ fun readyAnswer (@Header(" token" ) token : String ,
110+ @FieldMap data : HashMap <String , String ?>): Observable <BaseApiDao >
106111}
Original file line number Diff line number Diff line change @@ -1972,6 +1972,19 @@ public void decreaseMediaAttempt(QuestionApiDao question) {
19721972 }
19731973 }
19741974
1975+ public void setReadyAnswer (QuestionApiDao question ) {
1976+
1977+ if (!realm .isInTransaction () && question != null ) {
1978+ realm .beginTransaction ();
1979+
1980+ question .setIsAnswer (true );
1981+ realm .copyToRealmOrUpdate (question );
1982+ realm .commitTransaction ();
1983+ } else {
1984+ setReadyAnswer (question );
1985+ }
1986+ }
1987+
19751988 public boolean isLastAttempt () {
19761989 return getQuestionAttempt () <= 0 ;
19771990 }
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ public class QuestionApiDao extends RealmObject {
5454 private int media_id ;
5555 private int media_attempt ;
5656 private int media_attempt_left ;
57+ private boolean ready_answer ;
5758
5859 private RealmList <QuestionApiDao > sub_questions ;
5960
@@ -103,6 +104,14 @@ public int getPrepTime() {
103104 return prepTime ;
104105 }
105106
107+ public boolean isAnswer () {
108+ return ready_answer ;
109+ }
110+
111+ public void setIsAnswer (boolean is_answer ) {
112+ this .ready_answer = is_answer ;
113+ }
114+
106115 public void setPrepTime (int prepTime ) {
107116 this .prepTime = prepTime ;
108117 }
Original file line number Diff line number Diff line change @@ -116,4 +116,19 @@ class SectionRepository(astronautApi: AstronautApi) : BaseRepository(astronautAp
116116 astrntSDK.saveLastApiCall(" (/question/last_seen)" )
117117 return mAstronautApi.apiService.addLastSeen((token)!! , map)
118118 }
119+
120+ fun readyAnswer (questionId : Long? ): Observable <BaseApiDao > {
121+ val interviewApiDao = astrntSDK.currentInterview
122+ val token = interviewApiDao.token
123+ val map = HashMap <String , String ?>()
124+ map[" interview_code" ] = interviewApiDao.interviewCode
125+ map[" question_id" ] = questionId.toString()
126+ addNewLog(interviewApiDao.interviewCode,
127+ LogDao (" Hit API (/v2/media/ready-answer)" ,
128+ (" Ready answer, questionId = $questionId " )
129+ )
130+ )
131+ astrntSDK.saveLastApiCall(" (/media/ready-answer)" )
132+ return mAstronautApi.apiService.readyAnswer((token)!! , map)
133+ }
119134}
You can’t perform that action at this time.
0 commit comments