Skip to content

Commit

Permalink
Release 0.2.0-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-powers committed May 28, 2021
2 parents 58fa315 + 4dc88cd commit f6097ec
Show file tree
Hide file tree
Showing 186 changed files with 5,448 additions and 1,491 deletions.
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Cal Poly Software Engineering Capstone

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 3 additions & 2 deletions flipted/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ android {
applicationId "edu.calpoly.flipted"
minSdkVersion 28
targetSdkVersion 30
versionCode 4
versionName "0.1.3-alpha"
versionCode 5
versionName "0.2.0-alpha"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -49,6 +49,7 @@ android {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
def lifecycle_version = "2.3.1"
def fragment_version = "1.3.3"
def nav_version = "2.3.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import edu.calpoly.flipted.ui.MainActivity
import edu.calpoly.flipted.ui.goals.GoalsFragment
import edu.calpoly.flipted.ui.home.StudentHomeFragment
import org.hamcrest.CoreMatchers.allOf
import org.junit.Assert.*
import org.junit.Rule
Expand Down Expand Up @@ -46,12 +45,6 @@ class ActivityInputOutputTest {
//assertEquals(StudentHomeFragment,)
}

@Test fun testStudentHomeFragment() {
val scenario = launchFragmentInContainer<StudentHomeFragment>()
onView(allOf(withId(R.id.goals_button), withText("Goals")))
onView(allOf(withId(R.id.task_button), withText("Take Quiz")))
}

@Test fun testGoalsFragment() {
val scenario = launchFragmentInContainer<GoalsFragment>()
onView(allOf(withId(R.id.newGoalButton), withText("Add New Goal")))
Expand Down
4 changes: 2 additions & 2 deletions flipted/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
android:supportsRtl="true"
android:theme="@style/AppTheme.NoActionBar">
<activity android:name=".ui.MainActivity">

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.amazonaws.mobileconnectors.cognitoauth.activities.CustomTabsRedirectActivity">
<activity android:name="com.amazonaws.mobileconnectors.cognitoauth.activities.CustomTabsRedirectActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ query GetAllTargetProgress($courseId: String!){
objectiveId,
objectiveName
tasks {
taskId,
taskName,
task {
id,
name
}
mastery
}
}
Expand Down
25 changes: 18 additions & 7 deletions flipted/app/src/main/graphql/edu/calpoly/flipted/Missions.graphql
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
query GetAllMissionProgress($courseId:String!) {
query GetAllMissionProgress($courseId: String!) {
getAllMissionProgress(courseId: $courseId) {
mission {
id,
id
name
},
description
missionContent {
...on Task {
id
name
instructions
points
dueDate
}
}
}
progress {
taskId,
name,
taskId
name
submission {
graded,
pointsAwarded,
graded
pointsAwarded
pointsPossible
teacherComment
}
}
}
Expand Down
67 changes: 66 additions & 1 deletion flipted/app/src/main/graphql/edu/calpoly/flipted/Tasks.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ mutation SubmitTask($taskId: String!) {
questionId
pointsAwarded
answer
teacherComment
}
}
teacherComment
Expand Down Expand Up @@ -97,4 +98,68 @@ query GetTask($taskId:String!) {
answer
}
}
}
}

query GetTaskInfo($taskId:String!) {
task(taskId:$taskId) {
id,
name,
instructions,
points,
startAt,
endAt,
dueDate,
missionId,
missionIndex,
requirements {
id,
description
}
}
}

query GetTaskObjectiveProgress($taskId:String!) {
getTaskObjectiveProgress(taskId:$taskId) {
task {
id,
name
}
objective {
objectiveId,
objectiveName
}
mastery
}
}

query RetrieveTaskSubmission($taskId: String!){
retrieveTaskSubmission(taskId: $taskId) {
graded
pointsAwarded
pointsPossible
questionAndAnswers {
question {
... on FrQuestion {
id
description
points
answer
}
... on McQuestion {
id
description
points
answers
}
}
answer {
questionId
pointsAwarded
answer
teacherComment
}
}
teacherComment
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ApolloLearningTargetsRepo: ApolloRepo(), LearningTargetsRepo {
TargetProgress(targetProgress.target.let { target ->
LearningTarget(target.targetId, target.targetName) },targetProgress.objectives.map { objective ->
ObjectiveProgress(objective.objectiveId,objective.objectiveName,objective.tasks.map {
TaskObjectiveProgress(it.taskId,it.taskName, when(it.mastery) {
TaskObjectiveProgress(it.task.id,it.task.name, objective.objectiveId, objective.objectiveName, when(it.mastery) {
ApolloMastery.NOT_GRADED -> Mastery.NOT_GRADED
ApolloMastery.NOT_MASTERED -> Mastery.NOT_MASTERED
ApolloMastery.NEARLY_MASTERED -> Mastery.NEARLY_MASTERED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import android.util.Log
import com.apollographql.apollo.coroutines.await
import com.apollographql.apollo.exception.ApolloException
import edu.calpoly.flipted.GetAllMissionProgressQuery
import edu.calpoly.flipted.businesslogic.missions.Mission
import edu.calpoly.flipted.businesslogic.missions.MissionProgress
import edu.calpoly.flipted.businesslogic.missions.MissionsRepo
import edu.calpoly.flipted.businesslogic.missions.TaskStats
import edu.calpoly.flipted.businesslogic.missions.*
import edu.calpoly.flipted.businesslogic.tasks.data.TaskSubmissionResult

class ApolloMissionsRepo : ApolloRepo(), MissionsRepo {
Expand All @@ -27,28 +24,46 @@ class ApolloMissionsRepo : ApolloRepo(), MissionsRepo {

val missions = response.data?.getAllMissionProgress ?: throw IllegalStateException("Error when querying backend: bad response")


return missions.map { missionProgress ->
val tasks = missionProgress.mission.let{ mission ->
mission.missionContent?.mapNotNull { content ->
content?.asTask?.let { task ->
SparseTask(task.id, task.name, task.instructions, task.points, task.dueDate)
}
}?.associateBy {
it.id
} ?: throw IllegalStateException("Error when querying backend: bad response")
}
MissionProgress(
missionProgress.mission.let{ mission ->
Mission(mission.id, mission.name)
Mission(mission.id, mission.name, mission.description,
tasks.values.toList()
)
},
missionProgress.progress.map{ taskStat ->
TaskStats(
taskStat.taskId,
taskStat.name,
taskStat.submission?.let{ submission ->
TaskSubmissionResult(
tasks[taskStat.taskId] ?: throw IllegalArgumentException("Error when querying backend: bad response"),
when {
taskStat.submission == null -> null
else ->
taskStat.submission.let{ submission ->
TaskSubmissionResult(
taskStat.taskId,
submission.graded,
submission.pointsAwarded ?: throw IllegalArgumentException("Error when querying backend: bad response"),
submission.pointsPossible ?: throw IllegalArgumentException("Error when querying backend: bad response"),
submission.teacherComment,
listOf()
)
}
)
}
}
)
}
)
}
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import java.util.*

abstract class ApolloRepo {
companion object {
const val BACKEND_URL = "https://knyio2nl7d.execute-api.us-east-1.amazonaws.com/dev/graphql"
const val BACKEND_URL = "https://5orf8nzr57.execute-api.us-east-1.amazonaws.com/production/graphql"
}

private val dateCustomTypeAdapter = object: CustomTypeAdapter<Date> {
Expand Down
Loading

0 comments on commit f6097ec

Please sign in to comment.