Skip to content

Commit

Permalink
Merge pull request #132 from dadosjusbr/auxilio-saude
Browse files Browse the repository at this point in the history
adicionando auxilio-saúde
  • Loading branch information
joellensilva authored Mar 15, 2024
2 parents d7ccaca + fb58d75 commit 5da10c8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions models/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ type ItemSummary struct {
VacationCompensation float64 `json:"indenizacao_de_ferias,omitempty"`
ChristmasBonus float64 `json:"gratificacao_natalina,omitempty"`
CompensatoryLicense float64 `json:"licenca_compensatoria,omitempty"`
HealthAllowance float64 `json:"auxilio_saude,omitempty"`
Others float64 `json:"outras,omitempty"` // valor agregado de outras rubricas não identificadas
}
2 changes: 2 additions & 0 deletions repo/database/dto/annuaISummary.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func NewAnnualSummaryDTO(ami models.AnnualSummary) *AnnualSummaryDTO {
VacationCompensation: ami.ItemSummary.VacationCompensation,
ChristmasBonus: ami.ItemSummary.ChristmasBonus,
CompensatoryLicense: ami.ItemSummary.CompensatoryLicense,
HealthAllowance: ami.ItemSummary.HealthAllowance,
Others: ami.ItemSummary.Others,
},
}
Expand All @@ -53,6 +54,7 @@ func (ami *AnnualSummaryDTO) ConvertToModel() *models.AnnualSummary {
VacationCompensation: ami.ItemSummary.VacationCompensation,
ChristmasBonus: ami.ItemSummary.ChristmasBonus,
CompensatoryLicense: ami.ItemSummary.CompensatoryLicense,
HealthAllowance: ami.ItemSummary.HealthAllowance,
Others: ami.ItemSummary.Others,
},
}
Expand Down
3 changes: 3 additions & 0 deletions repo/database/dto/generalMonthlyInfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type ItemSummary struct {
VacationCompensation float64 `gorm:"column:indenizacao_de_ferias"`
ChristmasBonus float64 `gorm:"column:gratificacao_natalina"`
CompensatoryLicense float64 `gorm:"column:licenca_compensatoria"`
HealthAllowance float64 `gorm:"column:auxilio_saude"`
Others float64 `gorm:"column:outras"`
}

Expand All @@ -37,6 +38,7 @@ func NewGeneralMonthlyInfoDTO(gmi models.GeneralMonthlyInfo) *GeneralMonthlyInfo
VacationCompensation: gmi.ItemSummary.VacationCompensation,
ChristmasBonus: gmi.ItemSummary.ChristmasBonus,
CompensatoryLicense: gmi.ItemSummary.CompensatoryLicense,
HealthAllowance: gmi.ItemSummary.HealthAllowance,
Others: gmi.ItemSummary.Others,
},
}
Expand All @@ -56,6 +58,7 @@ func (gmi *GeneralMonthlyInfoDTO) ConvertToModel() *models.GeneralMonthlyInfo {
VacationCompensation: gmi.ItemSummary.VacationCompensation,
ChristmasBonus: gmi.ItemSummary.ChristmasBonus,
CompensatoryLicense: gmi.ItemSummary.CompensatoryLicense,
HealthAllowance: gmi.ItemSummary.HealthAllowance,
Others: gmi.ItemSummary.Others,
},
}
Expand Down
2 changes: 2 additions & 0 deletions repo/database/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ func (p *PostgresDB) GetAnnualSummary(agency string) ([]models.AnnualSummary, er
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'indenizacao_de_ferias' AS DECIMAL)) AS indenizacao_de_ferias,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'gratificacao_natalina' AS DECIMAL)) AS gratificacao_natalina,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'licenca_compensatoria' AS DECIMAL)) AS licenca_compensatoria,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'auxilio_saude' AS DECIMAL)) AS auxilio_saude,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'outras' AS DECIMAL)) AS outras,
COUNT(*) AS meses_com_dados`
m := p.db.Model(&dtoAgmi).Select(query)
Expand Down Expand Up @@ -371,6 +372,7 @@ func (p *PostgresDB) GetGeneralMonthlyInfosFromYear(year int) ([]models.GeneralM
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'indenizacao_de_ferias' AS DECIMAL)) AS indenizacao_de_ferias,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'gratificacao_natalina' AS DECIMAL)) AS gratificacao_natalina,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'licenca_compensatoria' AS DECIMAL)) AS licenca_compensatoria,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'auxilio_saude' AS DECIMAL)) AS auxilio_saude,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'outras' AS DECIMAL)) AS outras`
m := p.db.Model(&dtoAgmi).Select(query)
m = m.Where("ano = ? AND atual=true AND (procinfo IS NULL OR procinfo::text = 'null')", year)
Expand Down
7 changes: 7 additions & 0 deletions repo/database/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,7 @@ func (g getAnnualSummary) testWhenMonthlyInfoExists(t *testing.T) {
ChristmasBonus: 175,
CompensatoryLicense: 75,
VacationCompensation: 50,
HealthAllowance: 125,
},
},
},
Expand Down Expand Up @@ -1053,6 +1054,7 @@ func (g getAnnualSummary) testWhenMonthlyInfoExists(t *testing.T) {
VacationCompensation: agmi.Summary.ItemSummary.VacationCompensation + agmi2.Summary.ItemSummary.VacationCompensation,
ChristmasBonus: agmi.Summary.ItemSummary.ChristmasBonus + agmi2.Summary.ItemSummary.ChristmasBonus,
CompensatoryLicense: agmi.Summary.ItemSummary.CompensatoryLicense + agmi2.Summary.ItemSummary.CompensatoryLicense,
HealthAllowance: agmi.Summary.ItemSummary.HealthAllowance + agmi2.Summary.ItemSummary.HealthAllowance,
},
})
}
Expand All @@ -1079,6 +1081,7 @@ func (g getAnnualSummary) testWhenMonthlyInfoExists(t *testing.T) {
assert.Equal(t, amis[1].ItemSummary.VacationCompensation, returnedAmis[1].ItemSummary.VacationCompensation)
assert.Equal(t, amis[1].ItemSummary.ChristmasBonus, returnedAmis[1].ItemSummary.ChristmasBonus)
assert.Equal(t, amis[1].ItemSummary.CompensatoryLicense, returnedAmis[1].ItemSummary.CompensatoryLicense)
assert.Equal(t, amis[1].ItemSummary.HealthAllowance, returnedAmis[1].ItemSummary.HealthAllowance)
truncateTables()
}

Expand Down Expand Up @@ -1239,6 +1242,7 @@ func (g getGeneralMonthlyInfoFromYear) testWhenDataExists(t *testing.T) {
VacationCompensation: 50,
ChristmasBonus: 75,
CompensatoryLicense: 175,
HealthAllowance: 130,
},
},
},
Expand Down Expand Up @@ -1276,6 +1280,7 @@ func (g getGeneralMonthlyInfoFromYear) testWhenDataExists(t *testing.T) {
VacationCompensation: agmi.Summary.ItemSummary.VacationCompensation + agmi2.Summary.ItemSummary.VacationCompensation,
ChristmasBonus: agmi.Summary.ItemSummary.ChristmasBonus + agmi2.Summary.ItemSummary.ChristmasBonus,
CompensatoryLicense: agmi.Summary.ItemSummary.CompensatoryLicense + agmi2.Summary.ItemSummary.CompensatoryLicense,
HealthAllowance: agmi.Summary.ItemSummary.HealthAllowance + agmi2.Summary.ItemSummary.HealthAllowance,
},
})
}
Expand Down Expand Up @@ -1431,6 +1436,7 @@ func (s store) testWhenDataIsOK(t *testing.T) {
VacationCompensation: 125,
ChristmasBonus: 175,
CompensatoryLicense: 120,
HealthAllowance: 130,
Others: 200,
},
},
Expand Down Expand Up @@ -1499,6 +1505,7 @@ func (s store) testWhenDataIsOK(t *testing.T) {
assert.Equal(t, agmi.Summary.ItemSummary.VacationCompensation, result.Summary.ItemSummary.VacationCompensation)
assert.Equal(t, agmi.Summary.ItemSummary.ChristmasBonus, result.Summary.ItemSummary.ChristmasBonus)
assert.Equal(t, agmi.Summary.ItemSummary.CompensatoryLicense, result.Summary.ItemSummary.CompensatoryLicense)
assert.Equal(t, agmi.Summary.ItemSummary.HealthAllowance, result.Summary.ItemSummary.HealthAllowance)
truncateTables()
}

Expand Down

0 comments on commit 5da10c8

Please sign in to comment.