Navigation Menu

Skip to content
This repository has been archived by the owner on May 29, 2020. It is now read-only.

added tag model #79

Merged
merged 6 commits into from Nov 22, 2018
Merged

added tag model #79

merged 6 commits into from Nov 22, 2018

Conversation

adesouky
Copy link
Contributor

🎟️ Ticket(s): Closes #49


πŸ‘· Changes

Added tag models and create, get, delete, and change name operations

πŸ”¦ Testing Instructions

go to core/database and run "go test -run TestTag"

@adesouky adesouky requested a review from a team November 10, 2018 13:44
@codecov
Copy link

codecov bot commented Nov 10, 2018

Codecov Report

Merging #79 into master will decrease coverage by 0.13%.
The diff coverage is 77.78%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #79      +/-   ##
==========================================
- Coverage   80.57%   80.44%   -0.12%     
==========================================
  Files          23       24       +1     
  Lines         746      782      +36     
  Branches        4        4              
==========================================
+ Hits          601      629      +28     
- Misses        105      109       +4     
- Partials       40       44       +4
Flag Coverage Ξ”
#client 100% <ΓΈ> (ΓΈ) ⬆️
#golang 79.74% <77.78%> (-0.09%) ⬇️
Impacted Files Coverage Ξ”
core/database/tag.go 77.78% <77.78%> (ΓΈ)

Continue to review full report at Codecov.

Legend - Click here to learn more
Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data
Powered by Codecov. Last update 9b5e25d...ccac996. Read the comment docs.

Copy link
Member

@bobheadxi bobheadxi left a comment

Choose a reason for hiding this comment

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

wow thanks for getting this PR in! 😍

first of all, make sure you have a gofmt plugin installed on your IDE - I recommend using Visual Studio Code alongside the official Go plugin

it'll help you fix a lot of common errors (at a glance I see a few) and help keep our code consistent!

@adesouky
Copy link
Contributor Author

Yea that sounds so helpful ill definitely use it.
Upon testing, I found that the change name test is inconsistent.
Although the update operation goes through, the name change is not consistent. i.e it will change the name on one test run, but not on the following. I have no idea why though!

@bobheadxi
Copy link
Member

bobheadxi commented Nov 10, 2018

@adesouky hm interesting...

although on that front, I think there might have been a slight misunderstanding - there shouldn't be a need for a name change function, just the ability to add and remove tags from an applicant

we can clarify in a few hours, get some rest! 😁

@adesouky
Copy link
Contributor Author

Well good to know πŸ˜‚

@bobheadxi bobheadxi added this to In progress in Backend MVP via automation Nov 10, 2018
@adesouky adesouky moved this from In progress to Needs review in Backend MVP Nov 11, 2018
Copy link
Member

@bobheadxi bobheadxi left a comment

Choose a reason for hiding this comment

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

Awesome work! πŸŽ‰ See if you can model the tests after the new tests the way we talked about them yesterday! Great use of the go test -run TestTag suggestion as well

I think @srijonsaha should have a look at this too before we land this PR

Thanks! 😁

core/database/tag.go Outdated Show resolved Hide resolved
core/database/tag.go Show resolved Hide resolved
core/database/database_test.go Outdated Show resolved Hide resolved
core/database/database_test.go Outdated Show resolved Hide resolved
@bobheadxi
Copy link
Member

Oh yeah and don't worry about the merge conflicts too much - I can handle them for you before you merge if you want (but I recommend you give it a try locally! just run git pull origin master)

@bobheadxi bobheadxi requested review from srijonsaha-zz and a team November 11, 2018 19:43
core/database/tag.go Outdated Show resolved Hide resolved
@bobheadxi
Copy link
Member

another thing you could do is just submit this change and I can work off this commit and integrate it will the clubtable

I'll leave this up to @adesouky ! Anas, just add the "Ready for Review" label back to this PR when you've addressed the comments regarding the tests and the code cleanup (comments, etc.) - up to you if you want to add the changes for integrating with the club table - and I'll fix up the merge conflicts and we can merge this 😁

Copy link
Member

@bobheadxi bobheadxi left a comment

Choose a reason for hiding this comment

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

Awesome work cleaning this up @adesouky ! 😍

Left one super minor comment regarding naming - once that's fixed, I think we're good to merge this 😁

}

// GetTag gets the tag associated with Applicant_ID, Period_ID, & Event_ID
func (db *Database) GetTag(ApplicantID string, PeriodID string, EventID string, c *model.Club) (*model.Tag, error) {
Copy link
Member

Choose a reason for hiding this comment

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

in Go, variable names should be lowercased, as uppercased names have a special meaning in a lot of contexts (exports)

Suggested change
func (db *Database) GetTag(ApplicantID string, PeriodID string, EventID string, c *model.Club) (*model.Tag, error) {
func (db *Database) GetTag(applicantID string, periodID string, eventID string, c *model.Club) (*model.Tag, error) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it!

&model.Club{
ID: "1234",
Name: "Launchpad",
Description: "1337 h4x0r",
Copy link
Member

Choose a reason for hiding this comment

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

πŸ˜‰

@@ -0,0 +1,8 @@
package model

// Tag model
Copy link
Member

Choose a reason for hiding this comment

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

succinct, but it works πŸ˜…

@bobheadxi bobheadxi requested a review from a team November 21, 2018 19:12
Copy link
Member

@bobheadxi bobheadxi left a comment

Choose a reason for hiding this comment

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

great stuff, thanks @adesouky !

Backend MVP automation moved this from Needs review to Reviewer approved Nov 22, 2018
@bobheadxi
Copy link
Member

@ubclaunchpad/pinpoint as always, please take a look when yall have a chance

@bobheadxi bobheadxi merged commit 3d26b50 into master Nov 22, 2018
Backend MVP automation moved this from Reviewer approved to Done Nov 22, 2018
@bobheadxi bobheadxi deleted the tag_model branch November 22, 2018 02:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Backend MVP
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants