Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Course statistics #931

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ jobs:
root: ~/project
paths:
- build
- backend/sourcemap
- backend/sourcemp

push_backend:
executor: backend_build
Expand Down
4 changes: 2 additions & 2 deletions backend/bin/kafkaConsumer/common/createKafkaConsumer.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import checkConnectionInInterval from "/bin/kafkaConsumer/common/connectedChecker"
import * as Kafka from "node-rdkafka"
import { ConsumerGlobalConfig } from "node-rdkafka"
import { v4 } from "uuid"
import winston from "winston"

import type { PrismaClient } from "@prisma/client"

import { KafkaError } from "../../../bin/lib/errors"
import {
KAFKA_CONSUMER_GROUP,
KAFKA_DEBUG_CONTEXTS,
KAFKA_HOST,
KAFKA_TOP_OF_THE_QUEUE,
} from "../../../config"
import { attachPrismaEvents } from "../../../util/prismaLogger"
import { KafkaError } from "../../lib/errors"
import checkConnectionInInterval from "./connectedChecker"

const logCommit =
(logger: winston.Logger) => (err: any, topicPartitions: any) => {
Expand Down
6 changes: 4 additions & 2 deletions backend/bin/seedExercises.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as faker from "faker"
import { Exercise } from "@prisma/client"
import { sample } from "lodash"

import { Exercise } from "@prisma/client"

import prisma from "../prisma"

const createExercise = () => ({
Expand All @@ -9,7 +11,7 @@ const createExercise = () => ({
part: Math.round(Math.random() * 3 + 1),
section: Math.round(Math.random() * 3 + 1),
timestamp: new Date(),
custom_id: faker.random.uuid(),
custom_id: faker.datatype.uuid(),
})

const createExerciseCompletion = (exercise: Exercise) => ({
Expand Down
2 changes: 0 additions & 2 deletions backend/graphql/Completion/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,9 @@ export const CompletionMutations = extendType({
} catch (e: unknown) {
const message = e instanceof Error ? `${e.message}, ${e.stack}` : e
ctx.logger.error(`error processing after ${processed}: ${message}`)

return `error processing after ${processed}: ${message}`
}
}

return `${users.length} users rechecked`
},
})
Expand Down
2 changes: 1 addition & 1 deletion backend/graphql/Course/__test__/Course.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createReadStream } from "fs"
import { gql } from "graphql-request"
import { omit, orderBy } from "lodash"
import { mocked } from "jest-mock"
import { omit, orderBy } from "lodash"

import { Course } from "@prisma/client"

Expand Down
6 changes: 6 additions & 0 deletions backend/graphql/Course/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,11 @@ export const Course = objectType({
})
},
})

t.field("course_statistics", {
type: "CourseStatistics",
authorize: isAdmin,
resolve: ({ id }) => ({ course_id: id }),
})
},
})
Loading