Skip to content

Gabriel Guirguis - GS Onboarding#21

Closed
GabrielGuirguis wants to merge 3 commits intoUWOrbital:mainfrom
GabrielGuirguis:main
Closed

Gabriel Guirguis - GS Onboarding#21
GabrielGuirguis wants to merge 3 commits intoUWOrbital:mainfrom
GabrielGuirguis:main

Conversation

@GabrielGuirguis
Copy link

Purpose

Completed the GS on-boarding task. Include a screenshot of the front-end of the application.

New Changes

  • Explain new changes

Testing

  • Explain tests that you ran to verify code functionality.
  • Any functions that can be unit-tested should include a unit test in the PR. Otherwise, explain why it cannot be unit-tested.

Outstanding Changes

  • If there are non-critical changes (i.e. additional features) that can be made to this feature in the future, indicate them here.

Copy link
Contributor

@Yarik-Popov Yarik-Popov left a comment

Choose a reason for hiding this comment

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

Great you are back. The backend is on the right track. There are some changes that are needed to improve it.

query = select(Command).where(Command.id == id)
result = db.exec(query).first()

if not result:
Copy link
Contributor

Choose a reason for hiding this comment

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

Use is None here

response = await call_next(request)

duration = perf_counter() - start
logger.info
Copy link
Contributor

Choose a reason for hiding this comment

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

Good you are using perf_counter but the logging portion isnt done yet

validated_params = self.params
validated_format = self.format

if validated_params == None and validated_format == None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Use is instead of == when doing comparison against None


if validated_params == None and validated_format == None:
return self
elif isinstance(validated_params, str) and (isinstance(validated_format, str)) and validated_params.count(",") == validated_format.count(","):
Copy link
Contributor

Choose a reason for hiding this comment

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

Good you are checking if they are strings here. But .count() doesnt produce the correct result. For example "a,b" and "a," have the same number of commas but not the same number of comma separated values (empty isnt considered valid here)

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the redundant () around the 2nd isinstance

Comment on lines 25 to 26
await axios.delete(`${API_URL}/${id}`)
const { data } = await axios.get<CommandListResponse>(`${API_URL}/commands/`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete returns all the data so the get call is redundant and slows down performance

Comment on lines 35 to 36
validated_params = self.params
validated_format = self.format
Copy link
Contributor

Choose a reason for hiding this comment

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

Kinda of redundant ngl, the right side is shorter and more explicit

params: {validated_params}
format: {validated_format}\n"""))

return self
Copy link
Contributor

Choose a reason for hiding this comment

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

This return will never be reached because of the else raise block above

Comment on lines 42 to 47
else:
raise(ValueError
(f"""params and format must both be either None or have the same number of comma seperated values,
recieved:
params: {validated_params}
format: {validated_format}\n"""))
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove the else and unindent the raise. Also remove the () after the raise

@Yarik-Popov
Copy link
Contributor

I didnt review anything for the frontend past the api endpoint file

@Yarik-Popov
Copy link
Contributor

One thing to note for later. When you start working on a task do not create a fork on the main repo but clone it and branch off to work on a task. This will save u time needing to fix issues later

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.

2 participants