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

feat: show assignment information to students #22

Merged
merged 4 commits into from
Sep 22, 2023

Conversation

BryanttV
Copy link
Contributor

@BryanttV BryanttV commented Sep 19, 2023

Description

This PR adds:

  • Information on the assignment in the LMS.
  • The list of submissions only shows those in submitted and completed status.

How To Test

  1. Install this branch in your environment.
  2. Add a block in a unit from Studio.
  3. As a student, you should be able to see your assignment information.
  4. As an instructor, you should only see submissions in submitted and completed status.

Screenshots

As Student

  • Not Attempted
    image
  • Submitted
    image
  • Completed
    image

As Instructor

image

@BryanttV BryanttV marked this pull request as ready for review September 20, 2023 17:21
@BryanttV BryanttV requested review from Ian2012, mariajgrimaldi, johnvente and nandodev-net and removed request for Ian2012 and mariajgrimaldi September 20, 2023 17:21
@BryanttV BryanttV changed the title feat: show submission information to students feat: show assignment information to students Sep 20, 2023
StudentModule: A StudentModule object
"""
# pylint: disable=no-member
student_module, created = StudentModule.objects.get_or_create(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we using StudentModule objects directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edx-sga does something similar. Could we implement it in a better way?

@Ian2012
Copy link
Contributor

Ian2012 commented Sep 20, 2023

@BryanttV I don't think is a good approach to load the StudentModule object directly as it's not a good practice. All those implementations are behind the XBlock abstractions.

If your final goal is to store the state of the submission and show it to students, you can use some of the available scopes that will be best suited to your implementation. In the case none of the scopes is suitable for your purpose, try to compute the value your are searching for instead of storing it

Comment on lines 569 to 573
module = self.get_student_module(data.get("module_id"))
state = json.loads(module.state)
state["submission_status"] = SubmissionStatus.SUBMITTED.value
module.state = json.dumps(state)
module.save()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this to a function? These lines are very similar the ones above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@mariajgrimaldi
Copy link
Contributor

mariajgrimaldi commented Sep 20, 2023

@Ian2012: I agree that there must be a better way of doing this, but we don't have much more time left to invest in this. So it's better to use what we know works and integrates well with what we already have.

@mariajgrimaldi
Copy link
Contributor

@BryanttV @Ian2012 and I got to a better but similar solution: we can use the submissions API instead the Student Module, so we don't have to use the Django ORM.

const data = {
student_id: student_id,
module_id: module_id,
};
console.log(data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -295,9 +298,11 @@ function MindMapXBlock(runtime, element, context) {
.click(function () {
Copy link
Contributor

@johnvente johnvente Sep 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would create a constant called xblockId and would replace all these for xblockId instead of having context.xblock_id

const xblockId = context.xblock_id;

const grade = $(element).find(`#grade-input_${xblockId}`).val();
const submission_id = $(element).find(`#submission-id-input_${xblockId}`).val();
const module_id = $(element).find(`#module-id-input_${xblockId`).val();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

const data = {
grade: grade,
submission_id: submission_id,
module_id: module_id,
};
console.log(data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this

@@ -313,8 +318,10 @@ function MindMapXBlock(runtime, element, context) {
.find(`#remove-grade-button_${context.xblock_id}`)
.click(function () {
const student_id = $(element).find(`#student-id-input_${context.xblock_id}`).val();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as here

@BryanttV
Copy link
Contributor Author

For state management, we evaluated different solutions among them:

  1. implementation similar to SGA, reading the state information of a student using Django ORM to interact with the StudentModule.
  2. Using the Submissions API to store the status of the submission.
  3. Use an XBlock field of type user_summary_state to store shared information from all students about the submission status.

The second option we tried to implement, but it still has some edge cases that need to be evaluated in detail. The third option is still just an idea, but it has a caveat, when deleting the status of a student using the staff support tool, the update of this field must be fixed.

Finally, we decided to use the first option since it is already implemented and works correctly.

@mariajgrimaldi @Ian2012

Copy link
Contributor

@mariajgrimaldi mariajgrimaldi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working as expected!

@BryanttV BryanttV force-pushed the bav/show-submission-info branch from c7bce9c to e758703 Compare September 22, 2023 15:20
@BryanttV BryanttV merged commit c27b707 into main Sep 22, 2023
5 checks passed
@BryanttV BryanttV deleted the bav/show-submission-info branch September 22, 2023 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants