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

Quick fix for Tournament request errors #62

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions src/v4/ts/lib/interfaces/ITournament.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export interface ITournament{
// endTime: Date | null
// timezone: string | null
// venue: Venue
// organizer: Organizer

getId(): number
getName(): string
Expand All @@ -32,11 +31,6 @@ export interface ITournament{
getState(): string | null
getAddress(): string | null
getZipCode(): string | null
getOrganizer(): IOrganizer
getContactInfo(): string | null
getContactEmail(): string | null
getContactTwitter(): string | null
getOwnerId(): number | null

getEvents(): Promise<IEvent[]>
getPhases(): Promise<IPhase[]>
Expand Down Expand Up @@ -66,20 +60,13 @@ export interface ITournamentData{
postalCode: string | null
addrState: string | null
countryCode: string | null
region: string | null
venueAddress: string | null
venueName: string | null
gettingThere: string | null
lat: number | null
lng: number | null
timezone: string | null
startAt: number | null
endAt: number | null
contactInfo: string | null
contactEmail: string | null
contactTwitter: string | null
contactPhone: string | null
ownerId: number | null
}

export interface ITournamentEventData{
Expand Down
2 changes: 0 additions & 2 deletions src/v4/ts/lib/interfaces/IVenue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export interface IVenue{
getState(): string | null
getPostalCode(): string | null
getCountryCode(): string | null
getRegion(): string | null
getLatitude(): number | null
getLongitude(): number | null
}
Expand All @@ -31,7 +30,6 @@ export interface IVenueData{
city: string | null
addrState: string | null
countryCode: string | null
region: string | null
postalCode: string | null
lat: number | null
lng: number | null
Expand Down
34 changes: 3 additions & 31 deletions src/v4/ts/lib/models/Tournament.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,14 @@ export class Tournament implements ITournament{

const venue = new Venue(
data.venueName, data.venueAddress, data.city,
data.addrState, data.countryCode, data.region,
data.addrState, data.countryCode,
data.postalCode, data.lat, data.lng
)

const organizer = new Organizer(
data.ownerId, data.contactEmail, data.contactPhone,
data.contactTwitter, data.contactInfo
)

return new Tournament(
data.id, data.name, data.slug,
startTimeDate, endTimeDate, data.timezone,
venue, organizer
venue
)
}

Expand All @@ -79,7 +74,6 @@ export class Tournament implements ITournament{
private endTime: Date | null
private timezone: string | null
private venue: IVenue
private organizer: IOrganizer

constructor(
id: number,
Expand All @@ -88,8 +82,7 @@ export class Tournament implements ITournament{
startTime: Date | null,
endTime: Date | null,
timezone: string | null,
venue: IVenue,
organizer: IOrganizer
venue: IVenue
){
this.id = id
this.name = name
Expand All @@ -98,7 +91,6 @@ export class Tournament implements ITournament{
this.endTime = endTime
this.timezone = timezone
this.venue = venue
this.organizer = organizer
}

public getId(): number {
Expand Down Expand Up @@ -157,26 +149,6 @@ export class Tournament implements ITournament{
return this.venue.getPostalCode()
}

public getOrganizer(): IOrganizer {
return this.organizer
}

public getContactInfo(): string | null {
return this.organizer.getInfo()
}

public getContactEmail(): string | null {
return this.organizer.getEmail()
}

public getContactTwitter(): string | null {
return this.organizer.getTwitter()
}

public getOwnerId(): number | null {
return this.organizer.getId()
}

public async getEvents(): Promise<IEvent[]> {
log.info('Getting Events for Tournament [%s :: %s]', this.id, this.name)
const data: ITournamentEventData = await NI.query(queries.tournamentEvents, {id: this.id})
Expand Down
10 changes: 2 additions & 8 deletions src/v4/ts/lib/models/Venue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class Venue implements IVenue{
public static parse(data: IVenueData): IVenue{
const venue = new Venue(
data.data.tournament.venueName, data.data.tournament.venueAddress, data.data.tournament.city,
data.data.tournament.addrState, data.data.tournament.countryCode, data.data.tournament.region,
data.data.tournament.addrState, data.data.tournament.countryCode,
data.data.tournament.postalCode, data.data.tournament.lat, data.data.tournament.lng
)
return venue
Expand All @@ -25,21 +25,19 @@ export class Venue implements IVenue{
private state: string | null
private postalCode: string | null
private countryCode: string | null
private region: string | null
private latitude: number | null
private longitude: number | null

constructor(
name: string | null, address: string | null, city: string | null,
state: string | null, countryCode: string | null, region: string | null,
state: string | null, countryCode: string | null,
postalCode: string | null, latitude: number | null, longitude: number | null
){
this.name = name
this.address = address
this.city = city
this.state = state
this.countryCode = countryCode
this.region = region
this.postalCode = postalCode
this.latitude = latitude
this.longitude = longitude
Expand All @@ -65,10 +63,6 @@ export class Venue implements IVenue{
return this.countryCode
}

public getRegion() {
return this.region
}

public getPostalCode() {
return this.postalCode
}
Expand Down
8 changes: 1 addition & 7 deletions src/v4/ts/lib/scripts/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@ city
postalCode
addrState
countryCode
region
venueAddress
venueName
gettingThere
lat
lng
timezone
startAt
endAt
contactEmail
contactTwitter
contactPhone
ownerId`
endAt`

export const event = `
id
Expand Down
56 changes: 6 additions & 50 deletions src/v4/ts/test/data/tournament.testData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,13 @@ export const tournament1: ITournamentData = {
postalCode: '30339',
addrState: 'GA',
countryCode: 'US',
region: '11',
venueAddress: '2 Galleria Pkwy SE, Atlanta, GA 30339, USA',
venueName: 'The Cobb Galleria',
gettingThere: null,
lat: 33.8835141,
lng: -84.4655017,
timezone: 'America/New_York',
startAt: 1510401600,
endAt: 1510549140,
contactInfo: null,
contactEmail: 'thelabgaminginc@gmail.com',
contactTwitter: 'TheLabGamingCtr',
contactPhone: '404-368-5274',
ownerId: 11259
endAt: 1510549140
}

export const tournament2: ITournamentData = {
Expand All @@ -39,20 +32,13 @@ export const tournament2: ITournamentData = {
postalCode: '30062',
addrState: 'GA',
countryCode: 'US',
region: '11',
venueAddress: '2860 Meadow Dr, Marietta, GA 30062, USA',
venueName: null,
gettingThere: '',
lat: 34.0219068,
lng: -84.445532,
timezone: 'America/New_York',
startAt: 1532210400,
endAt: 1532231940,
contactInfo: null,
contactEmail: null,
contactTwitter: 'dontcallmeslips',
contactPhone: null,
ownerId: 91767
endAt: 1532231940
}

export const tournament3: ITournamentData = {
Expand All @@ -63,24 +49,13 @@ export const tournament3: ITournamentData = {
postalCode: '32819',
addrState: 'FL',
countryCode: 'US',
region: '10',
venueAddress: '8001 International Dr, Orlando, FL 32819, USA',
venueName: 'Wyndham Orlando Resort',
gettingThere:
'For information on how to get to the venue, food options and more please ' +
'visit http://www.ceogaming.org/ceohotel\n\nCEO at the Wyndham Orlando Resort ' +
'is located less than 20 minutes from the Orlando International Airport (MCO). ' +
'\n\nHotel Rooms will sell out fast for CEO 2016 at the Wyndham Orlando Resort so book now!',
lat: 28.448578,
lng: -81.4682618,
timezone: 'America/New_York',
startAt: 1466740800,
endAt: 1467000000,
contactInfo: 'For Media inquiries or Sponsorship/Partnership Opportunities please contact CEOGaming@gmail.com',
contactEmail: 'ceogaming@gmail.com',
contactTwitter: 'ceogaming',
contactPhone: null,
ownerId: 3431
endAt: 1467000000
}

export const tournamentData1 = {
Expand All @@ -99,39 +74,20 @@ export const tournamentData3 = {
export const venue1: IVenue = new Venue(
tournament1.venueName, tournament1.venueAddress,
tournament1.city, tournament1.addrState,
tournament1.countryCode, tournament1.region,
tournament1.countryCode,
tournament1.postalCode, tournament1.lat, tournament1.lng
)

export const venue2: IVenue = new Venue(
tournament2.venueName, tournament2.venueAddress,
tournament2.city, tournament2.addrState,
tournament2.countryCode, tournament2.region,
tournament2.countryCode,
tournament2.postalCode, tournament2.lat, tournament2.lng
)

export const venue3: IVenue = new Venue(
tournament3.venueName, tournament3.venueAddress,
tournament3.city, tournament3.addrState,
tournament3.countryCode, tournament3.region,
tournament3.countryCode,
tournament3.postalCode, tournament3.lat, tournament3.lng
)

// organizers
export const organizer1: IOrganizer = new Organizer(
tournament1.ownerId, tournament1.contactEmail,
tournament1.contactPhone, tournament1.contactTwitter,
tournament1.contactInfo
)

export const organizer2: IOrganizer = new Organizer(
tournament2.ownerId, tournament2.contactEmail,
tournament2.contactPhone, tournament2.contactTwitter,
tournament2.contactInfo
)

export const organizer3: IOrganizer = new Organizer(
tournament3.ownerId, tournament3.contactEmail,
tournament3.contactPhone, tournament3.contactTwitter,
tournament3.contactInfo
)
67 changes: 0 additions & 67 deletions src/v4/ts/test/tournament.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,73 +231,6 @@ describe('smashgg Tournament', function() {
expect(tournament3.getZipCode()).to.be.equal(testData.venue3.getPostalCode())
})

// organizer
it('should get the correct tournament organizer 1', () => {
expect(tournament1.getOrganizer()).to.deep.equal(testData.organizer1)
})
it('should get the correct tournament organizer 2', () => {
expect(tournament2.getOrganizer()).to.deep.equal(testData.organizer2)
})
it('should get the correct tournament organizer 3', () => {
expect(tournament3.getOrganizer()).to.deep.equal(testData.organizer3)
})

// organizer id
it('should get the correct tournament organizer id 1', () => {
expect(tournament1.getOwnerId()).to.be.equal(testData.tournament1.ownerId)
expect(tournament1.getOwnerId()).to.be.equal(testData.organizer1.getId())
})
it('should get the correct tournament organizer id 2', () => {
expect(tournament2.getOwnerId()).to.be.equal(testData.tournament2.ownerId)
expect(tournament2.getOwnerId()).to.be.equal(testData.organizer2.getId())
})
it('should get the correct tournament organizer id 3', () => {
expect(tournament3.getOwnerId()).to.be.equal(testData.tournament3.ownerId)
expect(tournament3.getOwnerId()).to.be.equal(testData.organizer3.getId())
})

// organizer contact info
it('should get the correct tournament organizer contact info 1', () => {
expect(tournament1.getContactInfo()).to.be.equal(testData.tournament1.contactInfo)
expect(tournament1.getContactInfo()).to.be.equal(testData.organizer1.getInfo())
})
it('should get the correct tournament organizer contact info 2', () => {
expect(tournament2.getContactInfo()).to.be.equal(testData.tournament2.contactInfo)
expect(tournament2.getContactInfo()).to.be.equal(testData.organizer2.getInfo())
})
it('should get the correct tournament organizer contact info 3', () => {
expect(tournament3.getContactInfo()).to.be.equal(testData.tournament3.contactInfo)
expect(tournament3.getContactInfo()).to.be.equal(testData.organizer3.getInfo())
})

// organizer contact email
it('should get the correct tournament organizer contact email 1', () => {
expect(tournament1.getContactEmail()).to.be.equal(testData.tournament1.contactEmail)
expect(tournament1.getContactEmail()).to.be.equal(testData.organizer1.getEmail())
})
it('should get the correct tournament organizer contact email 2', () => {
expect(tournament2.getContactEmail()).to.be.equal(testData.tournament2.contactEmail)
expect(tournament2.getContactEmail()).to.be.equal(testData.organizer2.getEmail())
})
it('should get the correct tournament organizer contact email 3', () => {
expect(tournament3.getContactEmail()).to.be.equal(testData.tournament3.contactEmail)
expect(tournament3.getContactEmail()).to.be.equal(testData.organizer3.getEmail())
})

// organizer contact info
it('should get the correct tournament organizer contact twitter 1', () => {
expect(tournament1.getContactTwitter()).to.be.equal(testData.tournament1.contactTwitter)
expect(tournament1.getContactTwitter()).to.be.equal(testData.organizer1.getTwitter())
})
it('should get the correct tournament organizer contact twitter 2', () => {
expect(tournament2.getContactTwitter()).to.be.equal(testData.tournament2.contactTwitter)
expect(tournament2.getContactTwitter()).to.be.equal(testData.organizer2.getTwitter())
})
it('should get the correct tournament organizer contact twitter 3', () => {
expect(tournament3.getContactTwitter()).to.be.equal(testData.tournament3.contactTwitter)
expect(tournament3.getContactTwitter()).to.be.equal(testData.organizer3.getTwitter())
})

/*attendee search*/
it('should correctly search attendees and find a match', async () => {
const searched: IAttendee[] | null = await tournament1.searchAttendees('GAwes')
Expand Down