GWM : shorting issue
This commit is contained in:
parent
3df25afd08
commit
dd5cad86b8
16
pb/main.go
16
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")
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 969 B |
97
pb/pb_public/privacy/index.html
Normal file
97
pb/pb_public/privacy/index.html
Normal file
@ -0,0 +1,97 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" class="h-full bg-gray-50">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Privacy Policy - FCSC</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
</head>
|
||||
<body class="h-full text-gray-800">
|
||||
<div class="max-w-4xl mx-auto p-8">
|
||||
<h1 class="text-3xl font-bold mb-6 text-gray-900">
|
||||
Privacy Policy
|
||||
</h1>
|
||||
|
||||
<p class="mb-4">
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p class="mb-6">
|
||||
By using the App, you consent to the practices described in this Privacy Policy.
|
||||
</p>
|
||||
|
||||
<h2 class="text-2xl font-semibold mt-8 mb-4">1. Information We Collect</h2>
|
||||
<h3 class="text-xl font-medium mt-4 mb-2">1.1 Personal Information</h3>
|
||||
<ul class="list-disc pl-6 mb-4">
|
||||
<li>Name, email address, phone number (when registering an account).</li>
|
||||
<li>User credentials (such as username and password).</li>
|
||||
<li>Demographic data (if provided by the user).</li>
|
||||
</ul>
|
||||
|
||||
<h3 class="text-xl font-medium mt-4 mb-2">1.2 Usage Data</h3>
|
||||
<ul class="list-disc pl-6 mb-4">
|
||||
<li>Device information (IP address, operating system, device type).</li>
|
||||
<li>App interactions (pages viewed, features used, actions performed).</li>
|
||||
<li>Log data (error reports, login timestamps).</li>
|
||||
</ul>
|
||||
|
||||
<h3 class="text-xl font-medium mt-4 mb-2">1.3 Location Data</h3>
|
||||
<p class="mb-4">If enabled, we may collect location-based data (to enhance certain features).</p>
|
||||
|
||||
<h3 class="text-xl font-medium mt-4 mb-2">1.4 Cookies and Tracking Technologies</h3>
|
||||
<p class="mb-6">We may use cookies, analytics tools, and tracking technologies to improve App functionality and user experience.</p>
|
||||
|
||||
<h2 class="text-2xl font-semibold mt-8 mb-4">2. How We Use Your Information</h2>
|
||||
<ul class="list-disc pl-6 mb-6">
|
||||
<li>Provide and improve services.</li>
|
||||
<li>Deliver insights, statistics, and reports.</li>
|
||||
<li>Personalize user experience.</li>
|
||||
<li>Ensure security and prevent unauthorized access.</li>
|
||||
<li>Comply with UAE laws and regulations.</li>
|
||||
<li>Communicate with users (inquiries, updates, support).</li>
|
||||
</ul>
|
||||
|
||||
<h2 class="text-2xl font-semibold mt-8 mb-4">3. How We Share Your Information</h2>
|
||||
<p class="mb-4">FCSC does not sell or trade your personal information. However, we may share data in the following cases:</p>
|
||||
<ul class="list-disc pl-6 mb-6">
|
||||
<li>Government and Legal Compliance (UAE authorities, legal obligations).</li>
|
||||
<li>Third-Party Service Providers (hosting, analytics, technical support).</li>
|
||||
<li>Security and Fraud Prevention.</li>
|
||||
</ul>
|
||||
|
||||
<h2 class="text-2xl font-semibold mt-8 mb-4">4. Data Storage and Security</h2>
|
||||
<ul class="list-disc pl-6 mb-6">
|
||||
<li>AES-256 encryption to protect user data.</li>
|
||||
<li>Stored on government-approved secure servers.</li>
|
||||
<li>Access only by authorized personnel.</li>
|
||||
<li>Data retained only as long as legally necessary.</li>
|
||||
</ul>
|
||||
|
||||
<h2 class="text-2xl font-semibold mt-8 mb-4">5. User Rights and Choices</h2>
|
||||
<ul class="list-disc pl-6 mb-6">
|
||||
<li>Access & Review your stored personal data.</li>
|
||||
<li>Correction & Deletion of personal data.</li>
|
||||
<li>Opt-Out of marketing communications.</li>
|
||||
<li>Disable location services via device settings.</li>
|
||||
</ul>
|
||||
<p class="mb-6">To exercise these rights, contact us at <strong>[Insert Official FCSC Email]</strong>.</p>
|
||||
|
||||
<h2 class="text-2xl font-semibold mt-8 mb-4">6. Third-Party Links and Services</h2>
|
||||
<p class="mb-6">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.</p>
|
||||
|
||||
<h2 class="text-2xl font-semibold mt-8 mb-4">7. Children's Privacy</h2>
|
||||
<p class="mb-6">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.</p>
|
||||
|
||||
<h2 class="text-2xl font-semibold mt-8 mb-4">8. Changes to This Privacy Policy</h2>
|
||||
<p class="mb-6">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.</p>
|
||||
|
||||
<h2 class="text-2xl font-semibold mt-8 mb-4">9. Contact Information</h2>
|
||||
<p class="mb-10">For privacy-related inquiries, you may contact: <strong>info@fcsc.gov.ae</strong></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 970 B |
BIN
pb_data/data.db
BIN
pb_data/data.db
Binary file not shown.
BIN
pb_data/data.db-shm
Executable file
BIN
pb_data/data.db-shm
Executable file
Binary file not shown.
BIN
pb_data/data.db-wal
Executable file
BIN
pb_data/data.db-wal
Executable file
Binary file not shown.
BIN
pb_data/logs.db
BIN
pb_data/logs.db
Binary file not shown.
BIN
pb_data/logs.db-shm
Normal file
BIN
pb_data/logs.db-shm
Normal file
Binary file not shown.
BIN
pb_data/logs.db-wal
Normal file
BIN
pb_data/logs.db-wal
Normal file
Binary file not shown.
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user