Code review comments.
Этот коммит содержится в:
@@ -1,5 +1,5 @@
|
||||
CREATE TABLE IF NOT EXISTS TrueUpReviewHistory (
|
||||
DueDate bigint(20),
|
||||
Completed boolean,
|
||||
PRIMARY KEY (duedate)
|
||||
PRIMARY KEY (DueDate)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
@@ -25,8 +25,8 @@ type TrueUpReviewPlugins struct {
|
||||
InactivePluginNames []string `json:"inactive_plugin_names"`
|
||||
}
|
||||
|
||||
func (t *TrueUpReviewPlugins) ToMap() map[string]any {
|
||||
return map[string]any{
|
||||
func (t *TrueUpReviewPlugins) ToMap() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"total_active_plugins": t.TotalActivePlugins,
|
||||
"total_inactive_plugins": t.TotalInactivePlugins,
|
||||
"active_plugin_names": t.ActivePluginNames,
|
||||
|
||||
@@ -112,7 +112,7 @@ type SqlStoreStores struct {
|
||||
notifyAdmin store.NotifyAdminStore
|
||||
postPriority store.PostPriorityStore
|
||||
postAcknowledgement store.PostAcknowledgementStore
|
||||
trueUpReviewStatus store.TrueUpReviewStore
|
||||
trueUpReview store.TrueUpReviewStore
|
||||
}
|
||||
|
||||
type SqlStore struct {
|
||||
@@ -221,7 +221,7 @@ func New(settings model.SqlSettings, metrics einterfaces.MetricsInterface) *SqlS
|
||||
store.stores.notifyAdmin = newSqlNotifyAdminStore(store)
|
||||
store.stores.postPriority = newSqlPostPriorityStore(store)
|
||||
store.stores.postAcknowledgement = newSqlPostAcknowledgementStore(store)
|
||||
store.stores.trueUpReviewStatus = newSqlTrueUpReviewStore(store)
|
||||
store.stores.trueUpReview = newSqlTrueUpReviewStore(store)
|
||||
|
||||
store.stores.preference.(*SqlPreferenceStore).deleteUnusedFeatures()
|
||||
|
||||
@@ -978,7 +978,7 @@ func (ss *SqlStore) PostAcknowledgement() store.PostAcknowledgementStore {
|
||||
}
|
||||
|
||||
func (ss *SqlStore) TrueUpReview() store.TrueUpReviewStore {
|
||||
return ss.stores.trueUpReviewStatus
|
||||
return ss.stores.trueUpReview
|
||||
}
|
||||
|
||||
func (ss *SqlStore) DropAllTables() {
|
||||
|
||||
@@ -35,8 +35,8 @@ hwIDAQAB
|
||||
|
||||
var LicenseValidator LicenseValidatorIface
|
||||
|
||||
const TrueUpReviewDueDay = 15
|
||||
const BusinessQuaterStep = 3
|
||||
const trueUpReviewDueDay = 15
|
||||
const businessQuarterStep = 3
|
||||
|
||||
func init() {
|
||||
if LicenseValidator == nil {
|
||||
@@ -232,16 +232,16 @@ func GetSanitizedClientLicense(l map[string]string) map[string]string {
|
||||
func GetNextTrueUpReviewDueDate(now time.Time) time.Time {
|
||||
quaterEndMonths := []time.Month{time.March, time.June, time.September, time.December}
|
||||
|
||||
var nextQuaterEndMonth time.Month = time.March
|
||||
var nextQuarterEndMonth time.Month = time.March
|
||||
for _, month := range quaterEndMonths {
|
||||
if now.Month() <= month && now.Day() <= TrueUpReviewDueDay {
|
||||
nextQuaterEndMonth = month
|
||||
if now.Month() <= month && now.Day() <= trueUpReviewDueDay {
|
||||
nextQuarterEndMonth = month
|
||||
break
|
||||
} else if now.Month() <= month && now.Day() > TrueUpReviewDueDay {
|
||||
nextQuaterEndMonth = month + BusinessQuaterStep
|
||||
} else if now.Month() <= month && now.Day() > trueUpReviewDueDay {
|
||||
nextQuarterEndMonth = month + businessQuarterStep
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return time.Date(now.Year(), nextQuaterEndMonth, TrueUpReviewDueDay, 0, 0, 0, 0, now.Location())
|
||||
return time.Date(now.Year(), nextQuarterEndMonth, trueUpReviewDueDay, 0, 0, 0, 0, now.Location())
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ func TestGetNextTrueUpReviewDueDate(t *testing.T) {
|
||||
assert.Equal(t, due.Day(), TrueUpReviewDueDay)
|
||||
})
|
||||
|
||||
t.Run("Due date will always be in next quater if the current date is past the 15th", func(t *testing.T) {
|
||||
t.Run("Due date will always be in next quarter if the current date is past the 15th", func(t *testing.T) {
|
||||
now := time.Date(2022, time.March, 16, 0, 0, 0, 0, time.Local)
|
||||
due := GetNextTrueUpReviewDueDate(now)
|
||||
assert.Equal(t, time.June, due.Month())
|
||||
@@ -129,7 +129,7 @@ func TestGetNextTrueUpReviewDueDate(t *testing.T) {
|
||||
assert.Equal(t, time.March, due.Month())
|
||||
})
|
||||
|
||||
t.Run("Due date will always be in the current quater if the current date is before or on the 15th", func(t *testing.T) {
|
||||
t.Run("Due date will always be in the current quarter if the current date is before or on the 15th", func(t *testing.T) {
|
||||
now := time.Date(2022, time.March, 15, 0, 0, 0, 0, time.Local)
|
||||
due := GetNextTrueUpReviewDueDate(now)
|
||||
assert.Equal(t, time.March, due.Month())
|
||||
|
||||
Ссылка в новой задаче
Block a user