diff --git a/pb.zip b/pb.zip index 0bec093..5211787 100644 Binary files a/pb.zip and b/pb.zip differ diff --git a/pb/main.go b/pb/main.go index 164745c..d75f467 100755 --- a/pb/main.go +++ b/pb/main.go @@ -475,6 +475,22 @@ func main() { app = pocketbase.New() + app.OnBeforeServe().Add(func(e *core.ServeEvent) error { + // Serve privacy policy static page + e.Router.GET("/privacy/*", apis.StaticDirectoryHandler(os.DirFS("./pb_public/privacy"), false)) + + // API endpoint: returns JSON policy + e.Router.GET("/api/privacy", func(c echo.Context) error { + policy := map[string]string{ + "title": "Privacy Policy", + "content": "We respect your privacy. Data is collected only for authentication and secure service delivery.", + } + return c.JSON(http.StatusOK, policy) + }) + + return nil + }) + // Hook to send notifications when a new record is created app.OnRecordAfterCreateRequest("notification").Add(func(e *core.RecordCreateEvent) error { title_en := e.Record.GetString("title_en") diff --git a/pb/pb_public/approve.png b/pb/pb_public/approve.png deleted file mode 100644 index c800e66..0000000 Binary files a/pb/pb_public/approve.png and /dev/null differ diff --git a/pb/pb_public/privacy/index.html b/pb/pb_public/privacy/index.html new file mode 100644 index 0000000..5a6491c --- /dev/null +++ b/pb/pb_public/privacy/index.html @@ -0,0 +1,97 @@ + + + + + Privacy Policy - FCSC + + + +
+

+ Privacy Policy +

+ +

+ Welcome to the Federal Competitiveness and Statistics Centre (FCSC) Mobile Application. + We value your privacy and data protection and are committed to safeguarding your personal + information. This Privacy Policy explains how we collect, use, share, and protect your information + when using this App. +

+ +

+ By using the App, you consent to the practices described in this Privacy Policy. +

+ +

1. Information We Collect

+

1.1 Personal Information

+ + +

1.2 Usage Data

+ + +

1.3 Location Data

+

If enabled, we may collect location-based data (to enhance certain features).

+ +

1.4 Cookies and Tracking Technologies

+

We may use cookies, analytics tools, and tracking technologies to improve App functionality and user experience.

+ +

2. How We Use Your Information

+ + +

3. How We Share Your Information

+

FCSC does not sell or trade your personal information. However, we may share data in the following cases:

+ + +

4. Data Storage and Security

+ + +

5. User Rights and Choices

+ +

To exercise these rights, contact us at [Insert Official FCSC Email].

+ +

6. Third-Party Links and Services

+

The App may contain links to external websites or services (e.g., UAE government portals). + FCSC is not responsible for third-party privacy practices. Users should review their respective Privacy Policies.

+ +

7. Children's Privacy

+

The App is not intended for children under 13 years. We do not knowingly collect data from minors. + Parents or guardians may request removal of a child’s data by contacting FCSC.

+ +

8. Changes to This Privacy Policy

+

We may update this Privacy Policy periodically to reflect changes in laws, technology, or user feedback. + The latest version will always be available in the App.

+ +

9. Contact Information

+

For privacy-related inquiries, you may contact: info@fcsc.gov.ae

+
+ + diff --git a/pb/pb_public/reject.png b/pb/pb_public/reject.png deleted file mode 100644 index c5165e6..0000000 Binary files a/pb/pb_public/reject.png and /dev/null differ diff --git a/pb_data/data.db b/pb_data/data.db index a76ce7e..cdb0c70 100755 Binary files a/pb_data/data.db and b/pb_data/data.db differ diff --git a/pb_data/data.db-shm b/pb_data/data.db-shm new file mode 100755 index 0000000..50345f1 Binary files /dev/null and b/pb_data/data.db-shm differ diff --git a/pb_data/data.db-wal b/pb_data/data.db-wal new file mode 100755 index 0000000..c019e9e Binary files /dev/null and b/pb_data/data.db-wal differ diff --git a/pb_data/logs.db b/pb_data/logs.db index 8d06f50..ededcfc 100644 Binary files a/pb_data/logs.db and b/pb_data/logs.db differ diff --git a/pb_data/logs.db-shm b/pb_data/logs.db-shm new file mode 100644 index 0000000..3461380 Binary files /dev/null and b/pb_data/logs.db-shm differ diff --git a/pb_data/logs.db-wal b/pb_data/logs.db-wal new file mode 100644 index 0000000..9da7163 Binary files /dev/null and b/pb_data/logs.db-wal differ diff --git a/utils/calculation.go b/utils/calculation.go index 88058f3..f957731 100755 --- a/utils/calculation.go +++ b/utils/calculation.go @@ -433,6 +433,7 @@ type ChartCalculationRequest struct { GroupByAndSum string `json:"groupby_and_sum"` AdditionalForGroupByAndSum string `json:"additional_for_groupby_and_sum"` GetTop string `json:"get_top"` + ShortBy string `json:"short_by"` Conversion string `json:"conversion"` } @@ -463,12 +464,27 @@ func CalculateGroupedSum(observations []Observation, request ChartCalculationReq }) } - // Sort by value in descending order - sort.Slice(valueList, func(i, j int) bool { - val1, _ := valueList[i].ObsValue.Value.Float64() - val2, _ := valueList[j].ObsValue.Value.Float64() - return val1 > val2 // Descending order - }) + // Sort by value in descending order or given key + shortByKey := request.ShortBy + if shortByKey != "" { + // Sort by given key + sort.Slice(valueList, func(i, j int) bool { + val1Str := valueList[i].ObsKey[shortByKey] + val2Str := valueList[j].ObsKey[shortByKey] + + val1, _ := strconv.ParseFloat(val1Str, 64) + val2, _ := strconv.ParseFloat(val2Str, 64) + + return val1 > val2 // Descending order + }) + } else { + // Default sorting by ObsValue.Value + sort.Slice(valueList, func(i, j int) bool { + val1, _ := valueList[i].ObsValue.Value.Float64() + val2, _ := valueList[j].ObsValue.Value.Float64() + return val1 > val2 // Descending order + }) + } // Get the top N values topN, err := strconv.Atoi(request.GetTop) @@ -526,12 +542,33 @@ func CalculateGroupedSum(observations []Observation, request ChartCalculationReq }) } + // Sort by value in descending order or given key + shortByKey := request.ShortBy + if shortByKey != "" { + // Sort by given key + sort.Slice(result, func(i, j int) bool { + val1Str := result[i].ObsKey[shortByKey] + val2Str := result[j].ObsKey[shortByKey] + + val1, _ := strconv.ParseFloat(val1Str, 64) + val2, _ := strconv.ParseFloat(val2Str, 64) + + return val1 > val2 // Descending order + }) + } else { + // Default sorting by ObsValue.Value + sort.Slice(result, func(i, j int) bool { + val1, _ := result[i].ObsValue.Value.Float64() + val2, _ := result[j].ObsValue.Value.Float64() + return val1 > val2 // Descending order + }) + } // Sort by summed values in descending order - sort.Slice(result, func(i, j int) bool { - val1, _ := result[i].ObsValue.Value.Float64() - val2, _ := result[j].ObsValue.Value.Float64() - return val1 > val2 // Sort descending - }) + // sort.Slice(result, func(i, j int) bool { + // val1, _ := result[i].ObsValue.Value.Float64() + // val2, _ := result[j].ObsValue.Value.Float64() + // return val1 > val2 // Sort descending + // }) // Get the top N values topN, err := strconv.Atoi(request.GetTop)