Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import okhttp3.Dispatcher
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import okhttp3.logging.HttpLoggingInterceptor.Level.BODY
import okhttp3.logging.HttpLoggingInterceptor.Level.BASIC
import org.hyperskill.academy.learning.*
import org.hyperskill.academy.learning.courseFormat.logger
Expand All @@ -19,6 +20,7 @@ import retrofit2.Call
import retrofit2.Response
import retrofit2.Retrofit
import java.net.HttpURLConnection.*
import java.util.logging.Level.FINE
import java.util.concurrent.TimeUnit


Expand Down Expand Up @@ -50,7 +52,10 @@ private fun createOkHttpClient(
dispatcher.maxRequests = 10

val logger = HttpLoggingInterceptor { LOG.info(it) }
logger.level = BASIC
val debugLoggingInterceptor = Interceptor { chain ->
logger.level = if (LOG.isLoggable(FINE)) BODY else BASIC
logger.intercept(chain)
}

val builder = OkHttpClient.Builder()
.connectionPool(connectionPool)
Expand All @@ -65,7 +70,7 @@ private fun createOkHttpClient(
val newRequest = builder.build()
chain.proceed(newRequest)
}
.addInterceptor(logger)
.addInterceptor(debugLoggingInterceptor)
.dispatcher(dispatcher)

if (customInterceptor != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ object HyperskillSubmissionFactory {

fun createRemoteEduTaskSubmission(task: RemoteEduTask, attempt: Attempt, files: List<SolutionFile>): StepikBasedSubmission {
val reply = EduTaskReply()
reply.score = if (task.status == CheckStatus.Solved) "1" else "0"
reply.solution = files
reply.checkProfile = task.checkProfile
return StepikBasedSubmission(attempt, reply)
Expand Down
Loading