Fixing some quotes not showing up
This commit is contained in:
parent
a579380905
commit
e11013bd9f
|
|
@ -88,7 +88,7 @@ SELECT
|
||||||
|
|
||||||
FROM quotes q
|
FROM quotes q
|
||||||
JOIN documents d ON d.id = q.document_id
|
JOIN documents d ON d.id = q.document_id
|
||||||
JOIN users u ON u.id = d.user_id
|
LEFT JOIN users u ON u.id = d.user_id
|
||||||
JOIN enquiries e ON e.id = q.enquiry_id
|
JOIN enquiries e ON e.id = q.enquiry_id
|
||||||
JOIN users uu ON uu.id = e.contact_user_id
|
JOIN users uu ON uu.id = e.contact_user_id
|
||||||
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
||||||
|
|
@ -106,8 +106,8 @@ ORDER BY q.valid_until
|
||||||
|
|
||||||
type GetExpiringSoonQuotesRow struct {
|
type GetExpiringSoonQuotesRow struct {
|
||||||
DocumentID int32 `json:"document_id"`
|
DocumentID int32 `json:"document_id"`
|
||||||
Username string `json:"username"`
|
Username sql.NullString `json:"username"`
|
||||||
UserEmail string `json:"user_email"`
|
UserEmail sql.NullString `json:"user_email"`
|
||||||
EnquiryID int32 `json:"enquiry_id"`
|
EnquiryID int32 `json:"enquiry_id"`
|
||||||
EnquiryRef string `json:"enquiry_ref"`
|
EnquiryRef string `json:"enquiry_ref"`
|
||||||
CustomerName string `json:"customer_name"`
|
CustomerName string `json:"customer_name"`
|
||||||
|
|
@ -203,7 +203,7 @@ SELECT
|
||||||
|
|
||||||
FROM quotes q
|
FROM quotes q
|
||||||
JOIN documents d ON d.id = q.document_id
|
JOIN documents d ON d.id = q.document_id
|
||||||
JOIN users u ON u.id = d.user_id
|
LEFT JOIN users u ON u.id = d.user_id
|
||||||
JOIN enquiries e ON e.id = q.enquiry_id
|
JOIN enquiries e ON e.id = q.enquiry_id
|
||||||
JOIN users uu ON uu.id = e.contact_user_id
|
JOIN users uu ON uu.id = e.contact_user_id
|
||||||
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
||||||
|
|
@ -227,8 +227,8 @@ type GetExpiringSoonQuotesOnDayParams struct {
|
||||||
|
|
||||||
type GetExpiringSoonQuotesOnDayRow struct {
|
type GetExpiringSoonQuotesOnDayRow struct {
|
||||||
DocumentID int32 `json:"document_id"`
|
DocumentID int32 `json:"document_id"`
|
||||||
Username string `json:"username"`
|
Username sql.NullString `json:"username"`
|
||||||
UserEmail string `json:"user_email"`
|
UserEmail sql.NullString `json:"user_email"`
|
||||||
EnquiryID int32 `json:"enquiry_id"`
|
EnquiryID int32 `json:"enquiry_id"`
|
||||||
EnquiryRef string `json:"enquiry_ref"`
|
EnquiryRef string `json:"enquiry_ref"`
|
||||||
CustomerName string `json:"customer_name"`
|
CustomerName string `json:"customer_name"`
|
||||||
|
|
@ -382,7 +382,7 @@ SELECT
|
||||||
|
|
||||||
FROM quotes q
|
FROM quotes q
|
||||||
JOIN documents d ON d.id = q.document_id
|
JOIN documents d ON d.id = q.document_id
|
||||||
JOIN users u ON u.id = d.user_id
|
LEFT JOIN users u ON u.id = d.user_id
|
||||||
JOIN enquiries e ON e.id = q.enquiry_id
|
JOIN enquiries e ON e.id = q.enquiry_id
|
||||||
JOIN users uu ON uu.id = e.contact_user_id
|
JOIN users uu ON uu.id = e.contact_user_id
|
||||||
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
||||||
|
|
@ -400,8 +400,8 @@ ORDER BY q.valid_until DESC
|
||||||
|
|
||||||
type GetRecentlyExpiredQuotesRow struct {
|
type GetRecentlyExpiredQuotesRow struct {
|
||||||
DocumentID int32 `json:"document_id"`
|
DocumentID int32 `json:"document_id"`
|
||||||
Username string `json:"username"`
|
Username sql.NullString `json:"username"`
|
||||||
UserEmail string `json:"user_email"`
|
UserEmail sql.NullString `json:"user_email"`
|
||||||
EnquiryID int32 `json:"enquiry_id"`
|
EnquiryID int32 `json:"enquiry_id"`
|
||||||
EnquiryRef string `json:"enquiry_ref"`
|
EnquiryRef string `json:"enquiry_ref"`
|
||||||
CustomerName string `json:"customer_name"`
|
CustomerName string `json:"customer_name"`
|
||||||
|
|
@ -495,7 +495,7 @@ SELECT
|
||||||
|
|
||||||
FROM quotes q
|
FROM quotes q
|
||||||
JOIN documents d ON d.id = q.document_id
|
JOIN documents d ON d.id = q.document_id
|
||||||
JOIN users u ON u.id = d.user_id
|
LEFT JOIN users u ON u.id = d.user_id
|
||||||
JOIN enquiries e ON e.id = q.enquiry_id
|
JOIN enquiries e ON e.id = q.enquiry_id
|
||||||
JOIN users uu ON uu.id = e.contact_user_id
|
JOIN users uu ON uu.id = e.contact_user_id
|
||||||
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
||||||
|
|
@ -513,8 +513,8 @@ ORDER BY q.valid_until DESC
|
||||||
|
|
||||||
type GetRecentlyExpiredQuotesOnDayRow struct {
|
type GetRecentlyExpiredQuotesOnDayRow struct {
|
||||||
DocumentID int32 `json:"document_id"`
|
DocumentID int32 `json:"document_id"`
|
||||||
Username string `json:"username"`
|
Username sql.NullString `json:"username"`
|
||||||
UserEmail string `json:"user_email"`
|
UserEmail sql.NullString `json:"user_email"`
|
||||||
EnquiryID int32 `json:"enquiry_id"`
|
EnquiryID int32 `json:"enquiry_id"`
|
||||||
EnquiryRef string `json:"enquiry_ref"`
|
EnquiryRef string `json:"enquiry_ref"`
|
||||||
CustomerName string `json:"customer_name"`
|
CustomerName string `json:"customer_name"`
|
||||||
|
|
|
||||||
|
|
@ -87,8 +87,18 @@ type QuoteRow interface {
|
||||||
type ExpiringSoonQuoteRowWrapper struct{ db.GetExpiringSoonQuotesRow }
|
type ExpiringSoonQuoteRowWrapper struct{ db.GetExpiringSoonQuotesRow }
|
||||||
|
|
||||||
func (q ExpiringSoonQuoteRowWrapper) GetID() int32 { return q.DocumentID }
|
func (q ExpiringSoonQuoteRowWrapper) GetID() int32 { return q.DocumentID }
|
||||||
func (q ExpiringSoonQuoteRowWrapper) GetUsername() string { return q.Username }
|
func (q ExpiringSoonQuoteRowWrapper) GetUsername() string {
|
||||||
func (q ExpiringSoonQuoteRowWrapper) GetUserEmail() string { return q.UserEmail }
|
if q.Username.Valid {
|
||||||
|
return q.Username.String
|
||||||
|
}
|
||||||
|
return "Unknown"
|
||||||
|
}
|
||||||
|
func (q ExpiringSoonQuoteRowWrapper) GetUserEmail() string {
|
||||||
|
if q.UserEmail.Valid {
|
||||||
|
return q.UserEmail.String
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
func (q ExpiringSoonQuoteRowWrapper) GetEnquiryID() int32 { return q.EnquiryID }
|
func (q ExpiringSoonQuoteRowWrapper) GetEnquiryID() int32 { return q.EnquiryID }
|
||||||
func (q ExpiringSoonQuoteRowWrapper) GetEnquiryRef() string { return q.EnquiryRef }
|
func (q ExpiringSoonQuoteRowWrapper) GetEnquiryRef() string { return q.EnquiryRef }
|
||||||
func (q ExpiringSoonQuoteRowWrapper) GetDateIssued() time.Time { return q.DateIssued }
|
func (q ExpiringSoonQuoteRowWrapper) GetDateIssued() time.Time { return q.DateIssued }
|
||||||
|
|
@ -101,8 +111,18 @@ func (q ExpiringSoonQuoteRowWrapper) GetCustomerEmail() string { return q.Cust
|
||||||
type RecentlyExpiredQuoteRowWrapper struct{ db.GetRecentlyExpiredQuotesRow }
|
type RecentlyExpiredQuoteRowWrapper struct{ db.GetRecentlyExpiredQuotesRow }
|
||||||
|
|
||||||
func (q RecentlyExpiredQuoteRowWrapper) GetID() int32 { return q.DocumentID }
|
func (q RecentlyExpiredQuoteRowWrapper) GetID() int32 { return q.DocumentID }
|
||||||
func (q RecentlyExpiredQuoteRowWrapper) GetUsername() string { return q.Username }
|
func (q RecentlyExpiredQuoteRowWrapper) GetUsername() string {
|
||||||
func (q RecentlyExpiredQuoteRowWrapper) GetUserEmail() string { return q.UserEmail }
|
if q.Username.Valid {
|
||||||
|
return q.Username.String
|
||||||
|
}
|
||||||
|
return "Unknown"
|
||||||
|
}
|
||||||
|
func (q RecentlyExpiredQuoteRowWrapper) GetUserEmail() string {
|
||||||
|
if q.UserEmail.Valid {
|
||||||
|
return q.UserEmail.String
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
func (q RecentlyExpiredQuoteRowWrapper) GetEnquiryID() int32 { return q.EnquiryID }
|
func (q RecentlyExpiredQuoteRowWrapper) GetEnquiryID() int32 { return q.EnquiryID }
|
||||||
func (q RecentlyExpiredQuoteRowWrapper) GetEnquiryRef() string { return q.EnquiryRef }
|
func (q RecentlyExpiredQuoteRowWrapper) GetEnquiryRef() string { return q.EnquiryRef }
|
||||||
func (q RecentlyExpiredQuoteRowWrapper) GetDateIssued() time.Time { return q.DateIssued }
|
func (q RecentlyExpiredQuoteRowWrapper) GetDateIssued() time.Time { return q.DateIssued }
|
||||||
|
|
@ -117,8 +137,18 @@ type ExpiringSoonQuoteOnDayRowWrapper struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q ExpiringSoonQuoteOnDayRowWrapper) GetID() int32 { return q.DocumentID }
|
func (q ExpiringSoonQuoteOnDayRowWrapper) GetID() int32 { return q.DocumentID }
|
||||||
func (q ExpiringSoonQuoteOnDayRowWrapper) GetUsername() string { return q.Username }
|
func (q ExpiringSoonQuoteOnDayRowWrapper) GetUsername() string {
|
||||||
func (q ExpiringSoonQuoteOnDayRowWrapper) GetUserEmail() string { return q.UserEmail }
|
if q.Username.Valid {
|
||||||
|
return q.Username.String
|
||||||
|
}
|
||||||
|
return "Unknown"
|
||||||
|
}
|
||||||
|
func (q ExpiringSoonQuoteOnDayRowWrapper) GetUserEmail() string {
|
||||||
|
if q.UserEmail.Valid {
|
||||||
|
return q.UserEmail.String
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
func (q ExpiringSoonQuoteOnDayRowWrapper) GetEnquiryID() int32 { return q.EnquiryID }
|
func (q ExpiringSoonQuoteOnDayRowWrapper) GetEnquiryID() int32 { return q.EnquiryID }
|
||||||
func (q ExpiringSoonQuoteOnDayRowWrapper) GetEnquiryRef() string { return q.EnquiryRef }
|
func (q ExpiringSoonQuoteOnDayRowWrapper) GetEnquiryRef() string { return q.EnquiryRef }
|
||||||
func (q ExpiringSoonQuoteOnDayRowWrapper) GetDateIssued() time.Time { return q.DateIssued }
|
func (q ExpiringSoonQuoteOnDayRowWrapper) GetDateIssued() time.Time { return q.DateIssued }
|
||||||
|
|
@ -135,8 +165,18 @@ type RecentlyExpiredQuoteOnDayRowWrapper struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q RecentlyExpiredQuoteOnDayRowWrapper) GetID() int32 { return q.DocumentID }
|
func (q RecentlyExpiredQuoteOnDayRowWrapper) GetID() int32 { return q.DocumentID }
|
||||||
func (q RecentlyExpiredQuoteOnDayRowWrapper) GetUsername() string { return q.Username }
|
func (q RecentlyExpiredQuoteOnDayRowWrapper) GetUsername() string {
|
||||||
func (q RecentlyExpiredQuoteOnDayRowWrapper) GetUserEmail() string { return q.UserEmail }
|
if q.Username.Valid {
|
||||||
|
return q.Username.String
|
||||||
|
}
|
||||||
|
return "Unknown"
|
||||||
|
}
|
||||||
|
func (q RecentlyExpiredQuoteOnDayRowWrapper) GetUserEmail() string {
|
||||||
|
if q.UserEmail.Valid {
|
||||||
|
return q.UserEmail.String
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
func (q RecentlyExpiredQuoteOnDayRowWrapper) GetEnquiryID() int32 { return q.EnquiryID }
|
func (q RecentlyExpiredQuoteOnDayRowWrapper) GetEnquiryID() int32 { return q.EnquiryID }
|
||||||
func (q RecentlyExpiredQuoteOnDayRowWrapper) GetEnquiryRef() string { return q.EnquiryRef }
|
func (q RecentlyExpiredQuoteOnDayRowWrapper) GetEnquiryRef() string { return q.EnquiryRef }
|
||||||
func (q RecentlyExpiredQuoteOnDayRowWrapper) GetDateIssued() time.Time { return q.DateIssued }
|
func (q RecentlyExpiredQuoteOnDayRowWrapper) GetDateIssued() time.Time { return q.DateIssued }
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ SELECT
|
||||||
|
|
||||||
FROM quotes q
|
FROM quotes q
|
||||||
JOIN documents d ON d.id = q.document_id
|
JOIN documents d ON d.id = q.document_id
|
||||||
JOIN users u ON u.id = d.user_id
|
LEFT JOIN users u ON u.id = d.user_id
|
||||||
JOIN enquiries e ON e.id = q.enquiry_id
|
JOIN enquiries e ON e.id = q.enquiry_id
|
||||||
JOIN users uu ON uu.id = e.contact_user_id
|
JOIN users uu ON uu.id = e.contact_user_id
|
||||||
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
||||||
|
|
@ -109,7 +109,7 @@ SELECT
|
||||||
|
|
||||||
FROM quotes q
|
FROM quotes q
|
||||||
JOIN documents d ON d.id = q.document_id
|
JOIN documents d ON d.id = q.document_id
|
||||||
JOIN users u ON u.id = d.user_id
|
LEFT JOIN users u ON u.id = d.user_id
|
||||||
JOIN enquiries e ON e.id = q.enquiry_id
|
JOIN enquiries e ON e.id = q.enquiry_id
|
||||||
JOIN users uu ON uu.id = e.contact_user_id
|
JOIN users uu ON uu.id = e.contact_user_id
|
||||||
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
||||||
|
|
@ -173,7 +173,7 @@ SELECT
|
||||||
|
|
||||||
FROM quotes q
|
FROM quotes q
|
||||||
JOIN documents d ON d.id = q.document_id
|
JOIN documents d ON d.id = q.document_id
|
||||||
JOIN users u ON u.id = d.user_id
|
LEFT JOIN users u ON u.id = d.user_id
|
||||||
JOIN enquiries e ON e.id = q.enquiry_id
|
JOIN enquiries e ON e.id = q.enquiry_id
|
||||||
JOIN users uu ON uu.id = e.contact_user_id
|
JOIN users uu ON uu.id = e.contact_user_id
|
||||||
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
||||||
|
|
@ -236,7 +236,7 @@ SELECT
|
||||||
|
|
||||||
FROM quotes q
|
FROM quotes q
|
||||||
JOIN documents d ON d.id = q.document_id
|
JOIN documents d ON d.id = q.document_id
|
||||||
JOIN users u ON u.id = d.user_id
|
LEFT JOIN users u ON u.id = d.user_id
|
||||||
JOIN enquiries e ON e.id = q.enquiry_id
|
JOIN enquiries e ON e.id = q.enquiry_id
|
||||||
JOIN users uu ON uu.id = e.contact_user_id
|
JOIN users uu ON uu.id = e.contact_user_id
|
||||||
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
JOIN latest_revision lr ON q.enquiry_id = lr.enquiry_id AND d.revision = lr.max_revision
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue