Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Productise
Browse files Browse the repository at this point in the history
  • Loading branch information
mt1976 committed Dec 4, 2022
1 parent 409ca28 commit 09514d6
Show file tree
Hide file tree
Showing 601 changed files with 17,172 additions and 40,201 deletions.
Binary file modified .DS_Store
Binary file not shown.
179 changes: 178 additions & 1 deletion application/estimationSession_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package application
// ----------------------------------------------------------------

import (
"fmt"
"net/http"
"strconv"

Expand All @@ -29,6 +30,7 @@ func EstimationSession_Publish_Impl(mux http.ServeMux) {
mux.HandleFunc(dm.EstimationSession_Formatted_PathView, EstimationSession_HandlerFormatted)
mux.HandleFunc(dm.EstimationSession_PathSetup, EstimationSession_HandlerSetup)
mux.HandleFunc(dm.EstimationSession_PathCreate, EstimationSession_HandlerCreate)
mux.HandleFunc(dm.EstimationSession_PathRemove, EstimationSession_HandlerRemove)
logs.Publish("Implementation", dm.EstimationSession_Title)

}
Expand Down Expand Up @@ -86,7 +88,9 @@ func EstimationSession_HandlerFormatted(w http.ResponseWriter, r *http.Request)
logs.Servicing(r.URL.Path)

searchID := core.GetURLparam(r, dm.EstimationSession_QueryString)
_, rD, _ := dao.EstimationSession_GetByID(searchID)
//_, rD, _ := dao.EstimationSession_GetByID(searchID)

rD := Estimationsession_Calculate(searchID)

pageDetail := dm.EstimationSession_Page{
Title: CardTitle(dm.EstimationSession_Title, core.Action_View),
Expand Down Expand Up @@ -271,3 +275,176 @@ func EstimationSession_HandlerSetup(w http.ResponseWriter, r *http.Request) {

ExecuteTemplate(dm.EstimationSession_TemplateSetup, w, r, pageDetail)
}

func Estimationsession_Calculate(searchID string) dm.EstimationSession {

logs.Processing("estimationsession_ReCalculate-->" + searchID)

_, esRecord, _ := dao.EstimationSession_GetByID(searchID)

// Get the list of all Features for this EstimationSession
foundFeatures, featureList, _ := dao.Feature_Active_ByEstimationSession_GetList(searchID)
logs.Information("Found Features: ", strconv.Itoa(foundFeatures))
// Get the current projiect id
_, proj, _ := dao.Project_GetByID(esRecord.ProjectID)

//Get the current profile
profileID := proj.ProfileID
originID := proj.OriginID
logs.Information("ProjectUI: ", esRecord.ProjectID)
logs.Information("ProfileID: ", profileID)
logs.Information("OriginID: ", originID)

_, profile, _ := dao.Profile_GetByCode(profileID)
//Get the current rate from the origin
_, origin, _ := dao.Origin_GetByCode(originID)

HoursInDay := stf(profile.HoursPerDay)
Rate := stf(origin.Rate)

logs.Information("HoursInDay: ", fts(HoursInDay))
logs.Information("Rate: ", fts(Rate))

Total_Reqs := 0.00
Total_AnaTest := 0.00
Total_Docs := 0.00
Total_Mgt := 0.00
Total_UAT := 0.00
Total_MKT := 0.00
Total_Contingency := 0.00
Total_DevEstimate := 0.00
Total_DevUplift := 0.00
// Range through the list of Features
for thisFeature, feature := range featureList {
// Sum up the estimates in this featre
// convert feature.Reqs to INT
logs.Information("Feature: ", strconv.Itoa(thisFeature))
logs.Information("Feature.Reqs: ", feature.Reqs)

Total_Reqs += stf(feature.Reqs)
Total_AnaTest += stf(feature.AnalystTest)
Total_Docs += stf(feature.Docs)
Total_Mgt += stf(feature.Mgt)
Total_UAT += stf(feature.UatSupport)
Total_MKT += stf(feature.Marketing)
Total_Contingency += stf(feature.Contingency)
Total_DevUplift += stf(feature.DevUplift)
Total_DevEstimate += stf(feature.DevEstimate)
}

logs.Information("Total_Reqs: ", fmt.Sprintf("%.2f", Total_Reqs))

RelHours := stf(esRecord.Releases) * HoursInDay

// Convert Hours to Days

Total_Reqs_Days, Total_Reqs_Cost := calculate(Total_Reqs, HoursInDay, Rate)
Total_AnaTest_Days, Total_AnaTest_Cost := calculate(Total_AnaTest, HoursInDay, Rate)
Total_Docs_Days, Total_Docs_Cost := calculate(Total_Docs, HoursInDay, Rate)
Total_Mgt_Days, Total_Mgt_Cost := calculate(Total_Mgt, HoursInDay, Rate)
Total_UAT_Days, Total_UAT_Cost := calculate(Total_UAT, HoursInDay, Rate)
Total_MKT_Days, Total_MKT_Cost := calculate(Total_MKT, HoursInDay, Rate)
//Total_Contingency_Days, Total_Contingency_Cost := calculate(Total_Contingency, HoursInDay, Rate)
//Total_DevEstimate_Days, Total_DevEstimate_Cost := calculate(Total_DevEstimate, HoursInDay, Rate)
Total_DevUplift_Days, Total_DevUplift_Cost := calculate(Total_DevUplift, HoursInDay, Rate)
Total_Rel_Days, Total_Rel_Cost := calculate(RelHours, HoursInDay, Rate)

Total_Days := Total_Reqs_Days + Total_AnaTest_Days + Total_Docs_Days + Total_Mgt_Days + Total_UAT_Days + Total_MKT_Days + Total_DevUplift_Days + Total_Rel_Days
Total_Cost := Total_Reqs_Cost + Total_AnaTest_Cost + Total_Docs_Cost + Total_Mgt_Cost + Total_UAT_Cost + Total_MKT_Cost + Total_DevUplift_Cost + Total_Rel_Cost

SupportUplift := Total_Cost * (stf(profile.SupportUplift) / 100)

esRecord.ReqDays = fts(Total_Reqs_Days + Total_AnaTest_Days + Total_Docs_Days + Total_MKT_Days)
esRecord.RegCost = fts(Total_Reqs_Cost + Total_AnaTest_Cost + Total_Docs_Cost + Total_MKT_Cost)
esRecord.ImpDays = fts(Total_DevUplift_Days)
esRecord.ImpCost = fts(Total_DevUplift_Cost)
esRecord.UatDays = fts(Total_UAT_Days)
esRecord.UatCost = fts(Total_UAT_Cost)
esRecord.MgtDays = fts(Total_Mgt_Days)
esRecord.MgtCost = fts(Total_Mgt_Cost)
esRecord.RelDays = fts(Total_Rel_Days)
esRecord.RelCost = fts(Total_Rel_Cost)

esRecord.SupportUplift = fts(SupportUplift)
esRecord.EffortTotal = fts(Total_Days)
esRecord.Total = fts(Total_Cost)

dao.EstimationSession_StoreSystem(esRecord)

return esRecord
}

func EstimationSession_HandlerRemove(w http.ResponseWriter, r *http.Request) {
// Mandatory Security Validation
if !(Session_Validate(w, r)) {
core.Logout(w, r)
return
}

inUTL := r.URL.Path
w.Header().Set("Content-Type", "text/html")
core.ServiceMessage(inUTL)

esID := core.GetURLparam(r, dm.EstimationSession_QueryString)

_, esREC, _ := dao.EstimationSession_GetByID(esID)

estimationSession_SoftDelete(esID)

REDR := dm.EstimationSession_ByProject_PathList + "?" + dm.EstimationSession_ByProject_QueryString + "=" + esREC.ProjectID
http.Redirect(w, r, REDR, http.StatusFound)
}

func estimationSession_SoftDelete(esID string) error {
dao.EstimationSession_SoftDelete(esID)

err := Feature_SoftDeleteByEstimationSessionID(esID)
if err != nil {
logs.Panic("Cannot SoftDelete Features {"+esID+"}", err)
return err
}
return nil
}

func EstimationSession_SoftDeleteByProjectID(projectID string) error {
// Get the list of Estimation Sessions
_, esList, _ := dao.EstimationSession_Active_ByProject_GetList(projectID)

for _, es := range esList {
err := estimationSession_SoftDelete(es.EstimationSessionID)
if err != nil {
logs.Panic("Cannot SoftDelete Estimation Session {"+es.EstimationSessionID+"}", err)
return err
}
}
return nil
}

func stf(in string) float64 {
out, _ := strconv.ParseFloat(in, 64)
return out
}

func fts(in float64) string {
out := strconv.FormatFloat(in, 'f', 2, 64)
return out
}

func calculate(hrs float64, hrsInDay float64, rate float64) (float64, float64) {

days := 0.00
cost := 0.00

if hrs != 0 {

if hrsInDay != 0 {
days = hrs / hrsInDay
}

if rate != 0 {
cost = hrs * rate
}
}

return days, cost
}
2 changes: 1 addition & 1 deletion application/featureNew_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func FeatureNew_HandlerCreate(w http.ResponseWriter, r *http.Request) {

dao.Feature_Store(item, r)

REDR := dm.Feature_PathView + "?" + dm.Feature_QueryString + "=" + newID
REDR := dm.Feature_ByEstimationSession_PathList + "?" + dm.Feature_ByEstimationSession_QueryString + "=" + item.EstimationSessionID
http.Redirect(w, r, REDR, http.StatusFound)
}

Expand Down
33 changes: 33 additions & 0 deletions application/feature_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
// Project_Publish annouces the endpoints available for this object
func Feature_Publish_Impl(mux http.ServeMux) {
mux.HandleFunc(dm.Feature_ByEstimationSession_PathList, Feature_ByEstimationSession_HandlerList)
mux.HandleFunc(dm.Feature_SoftDelete_Path, Feature_SoftDelete_Handler)
logs.Publish("Implementation", dm.Feature_Title)

}
Expand Down Expand Up @@ -69,3 +70,35 @@ func Feature_ByEstimationSession_HandlerList(w http.ResponseWriter, r *http.Requ
ExecuteTemplate(dm.Feature_ByEstimationSession_TemplateList, w, r, pageDetail)

}

// Project_HandlerList is the handler for the list page
func Feature_SoftDelete_Handler(w http.ResponseWriter, r *http.Request) {
// Mandatory Security Validation
if !(Session_Validate(w, r)) {
core.Logout(w, r)
return
}

inUTL := r.URL.Path
w.Header().Set("Content-Type", "text/html")
core.ServiceMessage(inUTL)

featureID := core.GetURLparam(r, dm.Feature_SoftDelete_QueryString)

_, featureREC, _ := dao.Feature_GetByID(featureID)

dao.Feature_SoftDelete(featureID)

REDR := dm.Feature_ByEstimationSession_PathList + "?" + dm.Feature_ByEstimationSession_QueryString + "=" + featureREC.EstimationSessionID
http.Redirect(w, r, REDR, http.StatusFound)
//ExecuteTemplate(dm.Feature_ByEstimationSession_TemplateList, w, r, pageDetail)

}

func Feature_SoftDeleteByEstimationSessionID(esID string) error {
_, featureList, err := dao.Feature_Active_ByEstimationSession_GetList(esID)
for _, feature := range featureList {
dao.Feature_SoftDelete(feature.FeatureID)
}
return err
}
2 changes: 1 addition & 1 deletion application/home_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func Home_HandlerView(w http.ResponseWriter, r *http.Request) {
// homePage.AppSQLDatabase = ApplicationSQLDatabase() + "-" + ApplicationPropertiesDB["instance"]
}

homePage.NoOrigins, homePage.OriginList, _ = dao.Origin_GetList()
homePage.NoOrigins, homePage.OriginList, _ = dao.Origin_GetActiveList()

ExecuteTemplate("Impl_Home", w, r, homePage)

Expand Down
56 changes: 56 additions & 0 deletions application/origin_impl.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package application

// ----------------------------------------------------------------
// Automatically generated "/application/origin.go"
// ----------------------------------------------------------------
// Package : application
// Object : Origin (origin)
// Endpoint : Origin (OriginID)
// For Project : github.com/mt1976/ebEstimates/
// ----------------------------------------------------------------
// Template Generator : Dysprosium [r4-21.12.31]
// Date & Time : 01/12/2022 at 09:40:01
// Who & Where : matttownsend (Matt Townsend) on silicon.local
// ----------------------------------------------------------------

import (
"net/http"

core "github.com/mt1976/ebEstimates/core"
dao "github.com/mt1976/ebEstimates/dao"
dm "github.com/mt1976/ebEstimates/datamodel"
logs "github.com/mt1976/ebEstimates/logs"
)

// Origin_Publish annouces the endpoints available for this object
func Origin_Publish_Impl(mux http.ServeMux) {
mux.HandleFunc(dm.Origin_PathRemove, Origin_HandlerRemove)

//Cannot Delete via GUI
logs.Publish("Implmentation", dm.Origin_Title)
}

func Origin_HandlerRemove(w http.ResponseWriter, r *http.Request) {
// Mandatory Security Validation
if !(Session_Validate(w, r)) {
core.Logout(w, r)
return
}

inUTL := r.URL.Path
w.Header().Set("Content-Type", "text/html")
core.ServiceMessage(inUTL)

originID := core.GetURLparam(r, dm.Origin_QueryString)
_, originREC, _ := dao.Origin_GetByID(originID)

dao.Origin_SoftDelete(originID)

err := Project_SoftDeleteByOriginCode(originREC.Code)
if err != nil {
logs.Panic("Cannot SoftDelete Projects {"+originID+"}", err)
}

REDR := "/home"
http.Redirect(w, r, REDR, http.StatusFound)
}
44 changes: 44 additions & 0 deletions application/project_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
// Project_Publish annouces the endpoints available for this object
func Project_Publish_Impl(mux http.ServeMux) {
mux.HandleFunc(dm.Project_Origin_PathList, Project_ByOrigin_HandlerList)
mux.HandleFunc(dm.Project_PathRemove, Project_HandlerRemove)
logs.Publish("Implementation", dm.Project_Title)

}
Expand Down Expand Up @@ -64,3 +65,46 @@ func Project_ByOrigin_HandlerList(w http.ResponseWriter, r *http.Request) {
ExecuteTemplate(dm.Project_Origin_TemplateList, w, r, pageDetail)

}

func Project_HandlerRemove(w http.ResponseWriter, r *http.Request) {
// Mandatory Security Validation
if !(Session_Validate(w, r)) {
core.Logout(w, r)
return
}

inUTL := r.URL.Path
w.Header().Set("Content-Type", "text/html")
core.ServiceMessage(inUTL)

projectID := core.GetURLparam(r, dm.Project_QueryString)

_, projectREC, _ := dao.ProjectAction_GetByID(projectID)

dao.Project_SoftDelete(projectID)

err := EstimationSession_SoftDeleteByProjectID(projectID)
if err != nil {
logs.Panic("Cannot SoftDelete Estimates {"+projectID+"}", err)
}

_, originREC, _ := dao.Origin_GetByCode(projectREC.OriginID)

REDR := dm.Project_Origin_PathList + "?" + dm.Project_Origin_QueryString + "=" + originREC.OriginID
http.Redirect(w, r, REDR, http.StatusFound)
}

func Project_SoftDeleteByOriginCode(originCODE string) error {
var returnList []dm.Project
noItems, returnList, _ := dao.Project_ByOrigin_Active_GetList(originCODE)
if noItems > 0 {
for _, projectREC := range returnList {
dao.Project_SoftDelete(projectREC.ProjectID)
err := EstimationSession_SoftDeleteByProjectID(projectREC.ProjectID)
if err != nil {
logs.Panic("Cannot SoftDelete Estimates {"+projectREC.ProjectID+"}", err)
}
}
}
return nil
}
Binary file modified assets/.DS_Store
Binary file not shown.
21 changes: 21 additions & 0 deletions assets/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 MDBootstrap

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file modified assets/License.pdf
Binary file not shown.
Loading

0 comments on commit 09514d6

Please sign in to comment.