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

Create a function for duplicate code #102

Open
noisecapella opened this issue Dec 2, 2020 · 0 comments
Open

Create a function for duplicate code #102

noisecapella opened this issue Dec 2, 2020 · 0 comments

Comments

@noisecapella
Copy link

pycharm is telling me there is a duplicate here

if self.course_image_uid and uid == self.course_image_uid:
self.course_image_s3_link = bucket_base_url + filename
self.course_image_alt_text = file.get("description")
self.parsed_json["image_src"] = self.course_image_s3_link
self.parsed_json["image_description"] = self.course_image_alt_text
if self.course_thumbnail_image_uid and uid == self.course_thumbnail_image_uid:
self.course_thumbnail_image_s3_link = bucket_base_url + filename
self.course_thumbnail_image_alt_text = file.get("description")
self.parsed_json["thumbnail_image_src"] = self.course_thumbnail_image_s3_link
self.parsed_json["thumbnail_image_description"] = self.course_thumbnail_image_alt_text

and here
if self.course_image_uid and uid == self.course_image_uid:
self.course_image_s3_link = bucket_base_url + filename
self.course_image_alt_text = file.get("description")
self.parsed_json["image_src"] = self.course_image_s3_link
self.parsed_json["image_description"] = self.course_image_alt_text
if self.course_thumbnail_image_uid and uid == self.course_thumbnail_image_uid:
self.course_thumbnail_image_s3_link = bucket_base_url + filename
self.course_thumbnail_image_alt_text = file.get("description")
self.parsed_json["thumbnail_image_src"] = self.course_thumbnail_image_s3_link
self.parsed_json["thumbnail_image_description"] = self.course_thumbnail_image_alt_text

It also looks like extract_media_locally and extract_foreign_media_locally have some shared code which could be refactored

@noisecapella noisecapella self-assigned this Dec 3, 2020
@noisecapella noisecapella removed their assignment Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant