Skip to content

Conversation

ugogon
Copy link
Contributor

@ugogon ugogon commented Dec 17, 2021

There are mutiple bugs regarding the autocompletion for students in the new submission site and the assessment extension site. This PR fixes them and adds autocompletion to the sudo site as well.

Motivation and Context

There are multiple bugs due to code redundancies and base64 that breaks the encoded string after 60 characters which results in invalid javascript. I removed the base64 conversion entirely because its not necessary.

How Has This Been Tested?

Autocompletion and submitting the form on the new submission, assessment extension and sudo site.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation, which is located at Autolab Docs
  • I have updated the documentation accordingly, included in this PR

Other issues / help required

This is not an optimal solution as we still have code redundancies. We should only write one autocompletion javascript file and import it wherever we need it.

@cg2v
Copy link
Member

cg2v commented Dec 17, 2021

I'm not necessarily suggesting that my versions of these fixes are better, but you might want to investigate cg2v@057493b and cg2v@752a44f as alternatives to 8d76c19. I approve of ad627d2 as identical to cg2v@f943353 (I could not remember how to reproduce the latter, so never submitted my own PR for it)

Copy link
Contributor

@victorhuangwq victorhuangwq left a comment

Choose a reason for hiding this comment

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

I will circle back on the Base64 encoding issue

@usersEncoded = {}
@course.course_user_data.each do |cud|
@users[cud.full_name_with_email] = cud.id
@usersEncoded[Base64.encode64(cud.full_name_with_email.strip).strip] = cud.id
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like we have this Base64 encoding here for a reason, perhaps for students who username is not stored in base64 format? I will have to take a further look before deciding what's the appropriate fix here.

Copy link
Member

Choose a reason for hiding this comment

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

Original issue: #931

Copy link
Member

Choose a reason for hiding this comment

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

Basically, autocomplete seems to strip leading spaces, etc. from names which can make ID lookup fail.

@victorhuangwq
Copy link
Contributor

cg2v@057493b and cg2v@752a44f seems to be the correct fix, in addressing the issue brought up a while back. #1013

@damianhxy
Copy link
Member

This PR coincides with the latest feature request by Prof Iliano (autocompletion for sudo) and is worth revisiting.

@damianhxy damianhxy linked an issue May 18, 2022 that may be closed by this pull request
@damianhxy
Copy link
Member

It is not tenable to remove the base64 encoding. Hence, I will be closing this PR and have opened PRs #1532 and #1533 to subsume this PR

@damianhxy damianhxy closed this May 19, 2022
@damianhxy damianhxy mentioned this pull request May 19, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to create an extension
4 participants