Skip to content

Commit

Permalink
Update feature branch with source (dev) (#167)
Browse files Browse the repository at this point in the history
* Initial commit for national holidays common services

* Initial commit to set up Rasa NLU file to add intents regarding national holidays

* #60

* #64

* Mock for weather service

* Revert "74 rest service servicesweatheree"

* Delete docs directory

* Delete DSL/Ruuter.public/calendar directory

* weather mock service

* rahvalagatus

* rahvaalagatus README

* electricity service

* added highest price service plus update readme

* userTime -> userDate. modified parameter naming, update readme. started time-period.yml service

* draft for time-period service

* added hb for time-period service

* time-period service

* helpers for time_period hb

* Update issue templates

* added highest-price mock, service, readme

* 73 rest service to fetch weather information about a specific region (#117)

* weather service

* updated readme and its location

---------

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>
Co-authored-by: matKlju <108662553+matKlju@users.noreply.github.com>
Co-authored-by: mati.kljukin@gmail.com <mati.kljukin@gmail.com>

* readme

* added 5 most recent initatives service + mock

* initiatives readme

* added 5 most-recent service + mock

* fixed upload, correct service files

* most-recent service

* most-recent service

* changed contants.ini - RUUTER_PUBLIC to CHATBOT_RUUTER_PUBLIC_INTERNAL_CS

* specified correct DMAPPER path

* 82 end client is able to get information about members participation statistics (#137)

* started riigikogu docs

* added members-participation service and created mock file

* updated mock members-participation

* added readme

* updated readme recent-voting service

* added recent-voting service

* added service and mock for five-most-recent votings service

* added service readme

* added five-most-recent service

* added members-participation statisics service + mock + readme

---------

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>

* added recent-voring serviće + mock + readme (#138)

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>

* 81 riigikogu service (#140)

* started riigikogu docs

* added members-participation service and created mock file

* updated mock members-participation

* added readme

* updated readme recent-voting service

* added recent-voting service

* added service and mock for five-most-recent votings service

* added service readme

* added five-most-recent service

* added members-participation statisics service + mock + readme

* 84 end client is able to get information about 5 most recent voting result (#139)

* Initial commit for national holidays common services

* Initial commit to set up Rasa NLU file to add intents regarding national holidays

* #60

* #64

* Mock for weather service

* Revert "74 rest service servicesweatheree"

* Delete docs directory

* Delete DSL/Ruuter.public/calendar directory

* weather mock service

* rahvalagatus

* rahvaalagatus README

* electricity service

* added highest price service plus update readme

* userTime -> userDate. modified parameter naming, update readme. started time-period.yml service

* draft for time-period service

* added hb for time-period service

* time-period service

* helpers for time_period hb

* added highest-price mock, service, readme

* readme

* added 5 most recent initatives service + mock

* initiatives readme

* added 5 most-recent service + mock

* fixed upload, correct service files

* most-recent service

* most-recent service

* changed contants.ini - RUUTER_PUBLIC to CHATBOT_RUUTER_PUBLIC_INTERNAL_CS

* specified correct DMAPPER path

---------

Co-authored-by: Rainer Türner <90505798+turnerrainer@users.noreply.github.com>
Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>

---------

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>
Co-authored-by: Rainer Türner <90505798+turnerrainer@users.noreply.github.com>

* 87 the end client can specify the time period to get electricity information about (#142) (#143)

* Initial commit for national holidays common services

* Initial commit to set up Rasa NLU file to add intents regarding national holidays

* #60

* #64

* Mock for weather service

* Revert "74 rest service servicesweatheree"

* Delete docs directory

* Delete DSL/Ruuter.public/calendar directory

* weather mock service

* rahvalagatus

* rahvaalagatus README

* Update issue templates

* 73 rest service to fetch weather information about a specific region (#117)

* weather service

* updated readme and its location

---------





* readme

* added 5 most recent initatives service + mock

* initiatives readme

* added 5 most-recent service + mock

* fixed upload, correct service files

* most-recent service

* most-recent service

* changed contants.ini - RUUTER_PUBLIC to CHATBOT_RUUTER_PUBLIC_INTERNAL_CS

* specified correct DMAPPER path

* 82 end client is able to get information about members participation statistics (#137)

* started riigikogu docs

* added members-participation service and created mock file

* updated mock members-participation

* added readme

* updated readme recent-voting service

* added recent-voting service

* added service and mock for five-most-recent votings service

* added service readme

* added five-most-recent service

* added members-participation statisics service + mock + readme

---------



* added recent-voring serviće + mock + readme (#138)



* 81 riigikogu service (#140)

* started riigikogu docs

* added members-participation service and created mock file

* updated mock members-participation

* added readme

* updated readme recent-voting service

* added recent-voting service

* added service and mock for five-most-recent votings service

* added service readme

* added five-most-recent service

* added members-participation statisics service + mock + readme

* 84 end client is able to get information about 5 most recent voting result (#139)

* Initial commit for national holidays common services

* Initial commit to set up Rasa NLU file to add intents regarding national holidays

* #60

* #64

* Mock for weather service

* Revert "74 rest service servicesweatheree"

* Delete docs directory

* Delete DSL/Ruuter.public/calendar directory

* weather mock service

* rahvalagatus

* rahvaalagatus README

* electricity service

* added highest price service plus update readme

* userTime -> userDate. modified parameter naming, update readme. started time-period.yml service

* draft for time-period service

* added hb for time-period service

* time-period service

* helpers for time_period hb

* added highest-price mock, service, readme

* readme

* added 5 most recent initatives service + mock

* initiatives readme

* added 5 most-recent service + mock

* fixed upload, correct service files

* most-recent service

* most-recent service

* changed contants.ini - RUUTER_PUBLIC to CHATBOT_RUUTER_PUBLIC_INTERNAL_CS

* specified correct DMAPPER path

---------




---------




* added time-period service, mock and readme (#141)



---------

Co-authored-by: Rainer Türner <90505798+turnerrainer@users.noreply.github.com>
Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>
Co-authored-by: jaX10bt <132996313+jaX10bt@users.noreply.github.com>

* 81 riigikogu service (#145)

* started riigikogu docs

* added members-participation service and created mock file

* updated mock members-participation

* added readme

* updated readme recent-voting service

* added recent-voting service

* added service and mock for five-most-recent votings service

* added service readme

* added five-most-recent service

* added members-participation statisics service + mock + readme

* 84 end client is able to get information about 5 most recent voting result (#139)

* Initial commit for national holidays common services

* Initial commit to set up Rasa NLU file to add intents regarding national holidays

* #60

* #64

* Mock for weather service

* Revert "74 rest service servicesweatheree"

* Delete docs directory

* Delete DSL/Ruuter.public/calendar directory

* weather mock service

* rahvalagatus

* rahvaalagatus README

* electricity service

* added highest price service plus update readme

* userTime -> userDate. modified parameter naming, update readme. started time-period.yml service

* draft for time-period service

* added hb for time-period service

* time-period service

* helpers for time_period hb

* added highest-price mock, service, readme

* readme

* added 5 most recent initatives service + mock

* initiatives readme

* added 5 most-recent service + mock

* fixed upload, correct service files

* most-recent service

* most-recent service

* changed contants.ini - RUUTER_PUBLIC to CHATBOT_RUUTER_PUBLIC_INTERNAL_CS

* specified correct DMAPPER path

---------

Co-authored-by: Rainer Türner <90505798+turnerrainer@users.noreply.github.com>
Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>

* Merge pull request #136 from matKlju/84-end-client-is-able-to-get-inf… (#144)

---------

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>
Co-authored-by: Rainer Türner <90505798+turnerrainer@users.noreply.github.com>

* 64 create a ruuter service to link text input with national holidays common services (#146)

* 64 create a ruuter service to link text input with national holidays common services (#147)

* 87 the end client can specify the time period to get electricity information about (#142) (#148)

* Initial commit for national holidays common services

* Initial commit to set up Rasa NLU file to add intents regarding national holidays

* #60

* #64

* Mock for weather service

* Revert "74 rest service servicesweatheree"

* Delete docs directory

* Delete DSL/Ruuter.public/calendar directory

* weather mock service

* rahvalagatus

* rahvaalagatus README

* Update issue templates

* 73 rest service to fetch weather information about a specific region (#117)

* weather service

* updated readme and its location

---------





* readme

* added 5 most recent initatives service + mock

* initiatives readme

* added 5 most-recent service + mock

* fixed upload, correct service files

* most-recent service

* most-recent service

* changed contants.ini - RUUTER_PUBLIC to CHATBOT_RUUTER_PUBLIC_INTERNAL_CS

* specified correct DMAPPER path

* 82 end client is able to get information about members participation statistics (#137)

* started riigikogu docs

* added members-participation service and created mock file

* updated mock members-participation

* added readme

* updated readme recent-voting service

* added recent-voting service

* added service and mock for five-most-recent votings service

* added service readme

* added five-most-recent service

* added members-participation statisics service + mock + readme

---------



* added recent-voring serviće + mock + readme (#138)



* 81 riigikogu service (#140)

* started riigikogu docs

* added members-participation service and created mock file

* updated mock members-participation

* added readme

* updated readme recent-voting service

* added recent-voting service

* added service and mock for five-most-recent votings service

* added service readme

* added five-most-recent service

* added members-participation statisics service + mock + readme

* 84 end client is able to get information about 5 most recent voting result (#139)

* Initial commit for national holidays common services

* Initial commit to set up Rasa NLU file to add intents regarding national holidays

* #60

* #64

* Mock for weather service

* Revert "74 rest service servicesweatheree"

* Delete docs directory

* Delete DSL/Ruuter.public/calendar directory

* weather mock service

* rahvalagatus

* rahvaalagatus README

* electricity service

* added highest price service plus update readme

* userTime -> userDate. modified parameter naming, update readme. started time-period.yml service

* draft for time-period service

* added hb for time-period service

* time-period service

* helpers for time_period hb

* added highest-price mock, service, readme

* readme

* added 5 most recent initatives service + mock

* initiatives readme

* added 5 most-recent service + mock

* fixed upload, correct service files

* most-recent service

* most-recent service

* changed contants.ini - RUUTER_PUBLIC to CHATBOT_RUUTER_PUBLIC_INTERNAL_CS

* specified correct DMAPPER path

---------




---------




* added time-period service, mock and readme (#141)



---------

Co-authored-by: Rainer Türner <90505798+turnerrainer@users.noreply.github.com>
Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>
Co-authored-by: jaX10bt <132996313+jaX10bt@users.noreply.github.com>

* 81 riigikogu service (#150)

* started riigikogu docs

* added members-participation service and created mock file

* updated mock members-participation

* added readme

* updated readme recent-voting service

* added recent-voting service

* added service and mock for five-most-recent votings service

* added service readme

* added five-most-recent service

* added members-participation statisics service + mock + readme

* 84 end client is able to get information about 5 most recent voting result (#139)

* Initial commit for national holidays common services

* Initial commit to set up Rasa NLU file to add intents regarding national holidays

* #60

* #64

* Mock for weather service

* Revert "74 rest service servicesweatheree"

* Delete docs directory

* Delete DSL/Ruuter.public/calendar directory

* weather mock service

* rahvalagatus

* rahvaalagatus README

* electricity service

* added highest price service plus update readme

* userTime -> userDate. modified parameter naming, update readme. started time-period.yml service

* draft for time-period service

* added hb for time-period service

* time-period service

* helpers for time_period hb

* added highest-price mock, service, readme

* readme

* added 5 most recent initatives service + mock

* initiatives readme

* added 5 most-recent service + mock

* fixed upload, correct service files

* most-recent service

* most-recent service

* changed contants.ini - RUUTER_PUBLIC to CHATBOT_RUUTER_PUBLIC_INTERNAL_CS

* specified correct DMAPPER path

---------

Co-authored-by: Rainer Türner <90505798+turnerrainer@users.noreply.github.com>
Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>

* Merge pull request #136 from matKlju/84-end-client-is-able-to-get-inf… (#144)

---------

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>
Co-authored-by: Rainer Türner <90505798+turnerrainer@users.noreply.github.com>

* 87 the end client can specify the time period to get electricity information about (#151)

* added time-period service, mock and readme

* update READEme

---------

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>

* update riigikogu readme (#152)

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>

* refactored CS repo (#154) (#156)

* refactored CS repo

* added missing nationa-holiday service

* added missing national-holidays

* national-holidays documentation and electricity

* rename rahvalagatus to public-initiatives and moved initiatives-events-popular to legacy

* deleted national-holidays routing file - not needed

---------

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>

* 60 rest endpoint to retrieve national holidays in estonia (#159)

* refactored CS repo (#154) (#156) (#157)

* refactored CS repo

* added missing nationa-holiday service

* added missing national-holidays

* national-holidays documentation and electricity

* rename rahvalagatus to public-initiatives and moved initiatives-events-popular to legacy

* deleted national-holidays routing file - not needed

---------

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>

* 60 rest endpoint to retrieve national holidays in estonia (#158)

* refactored hbs/calendar directory

* minor refactor next steps

* update HB, refactor national-services

* HB for by-month service. refactored other sevices to use HB

* addede result formatting

* output formatting

* update readme and small refactor

* mock ytd service

* added mock services

--------

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>

* Update README.md

update readme

* Refactor Services Formatting (#160)

* Refactor Services Formatting

* Formatted Companies Responses

* Update Data Mapper Path

* Formated bot responses hbs

* dm format step rupdate (#161)

* update riigikogu readme

* update DM call

* added last format message step, specified DM path

* format Step refactor

---------

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>

* parameter acceptance management (#162)

* update riigikogu readme

* update DM call

* added last format message step, specified DM path

* format Step refactor

* added always accepting chatId and userID

* changed parameters input syntax

---------

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>

* weather service update (#163)

* update riigikogu readme

* update DM call

* added last format message step, specified DM path

* format Step refactor

* added always accepting chatId and userID

* changed parameters input syntax

* changed input pramateres sytnax , depending on GET directory

* refactored weather service

---------

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>

* . (#164)

* 00 dev branch refactor services (#165) (#166)

* added fromatMessage DM step to electricity service/ input params/ notice for time-period

* update public-initiatives service/ DM formatStep

* incoming params chatID authorID

* formatStep DM, input prameters

---------

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>

---------

Co-authored-by: Mati Kljukin <matik@matik-5420.ria.ee>
Co-authored-by: matKlju <108662553+matKlju@users.noreply.github.com>
Co-authored-by: mati.kljukin@gmail.com <mati.kljukin@gmail.com>
Co-authored-by: jaX10bt <132996313+jaX10bt@users.noreply.github.com>
Co-authored-by: Ahmed yasser <26207361+1AhmedYasser@users.noreply.github.com>
  • Loading branch information
6 people authored Oct 25, 2024
1 parent 1e45dd0 commit 2dc8e20
Show file tree
Hide file tree
Showing 98 changed files with 4,629 additions and 1,171 deletions.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Bug report
about: For reporting bugs
title: "[BUG]"
labels: bug
assignees: ''

---

**Bug description:**


**Expected behavior:**


**Screenshots:**


**Additional information:**
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Feature request
about: New feature or enhancement
title: ''
labels: ''
assignees: ''

---

**AS A** *role or user type*
**I WANT** *the feature or functionality desired*
**SO THAT** *desired outcome or goal*

### Acceptance Criteria

- [ ] ...
14 changes: 14 additions & 0 deletions DSL/DMapper/hbs/bot_responses_to_messages.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{{#each data.botMessages}}
{
"chatId": "{{../data.chatId}}",
"content": "{{{choose text result}}}",
"buttons": "[{{#each buttons}}{\"title\": \"{{{title}}}\",\"payload\": \"{{{payload}}}\"}{{#unless @last}},{{/unless}}{{/each}}]",
"authorTimestamp": "{{../data.authorTimestamp}}",
"authorId": "{{../data.authorId}}",
"authorFirstName": "{{../data.authorFirstName}}",
"authorLastName": "{{../data.authorLastName}}",
"created": "{{../data.created}}"
}{{#unless @last}},{{/unless}}
{{/each}}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
### Input example:
{
"response": [
{
"date": "2024-06-23",
"name": "võidupüha"
},
{
"date": "2024-06-24",
"name": "jaanipäev"
}
]
}
### Output example:
{
"result": "Kõik riigipühad antud kuus on: \n*2024-06-23\n võidupüha\n\n*2024-06-24\n jaanipäev\n\n"
}
-->

{
"result": "Kõik riigipühad antud kuus on: \n{{#each response}}*{{date}}\n {{name}}\n\n{{/each}}"
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
-->

{
"result": "Kõik pühad aasta algusest kuni tänaseni:{{#each response}}\n* {{this.date}}\n{{this.name}}\n{{/each}}"
"result": "Kõik riigipühad aasta algusest kuni tänaseni:{{#each response}}\n* {{this.date}}\n{{this.name}}\n{{/each}}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
}
-->
{
"result": "Kõik pühad sellel aastal on:\n{{#each response}} * {{this.date}}\n{{this.name}}\n{{/each}}"
"result": "Kõik riigipühad sellel aastal on:\n{{#each response}} * {{this.date}}\n{{this.name}}\n{{/each}}"
}
18 changes: 0 additions & 18 deletions DSL/DMapper/hbs/calendar/national-holidays/search.handlebars

This file was deleted.

33 changes: 33 additions & 0 deletions DSL/DMapper/hbs/electricity/get_time_period.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!--
### Input example:
{
"response": [
{
"timestamp": 1727730000,
"price": 5.01
},
{
"timestamp": 1727733600,
"price": 3.21
},
...
]
}
### Output example:
{
"result" : "Electricity prices from 2024-10-01 til 2024-10-14
* 2024-10-01 00:00 5.01 €/MWh
* 2024-10-01 01:00 3.21 €/MWh
* 2024-10-01 02:00 0.07 €/MWh
...
}
-->

{
"response" : "Elektrihinnad alates {{startDate response}} kuni {{endDate response}}
€/MWh
{{#each response}}
* {{formatTimestamp this.timestamp}} {{addVAT this.price}}
{{/each}}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{{#each data.botMessages}}
{
"chatId": "{{../data.chatId}}",
"content": "{{formatDataByBusinessRegister ../data}}",
"buttons": "[{{#each buttons}}{\"title\": \"{{{title}}}\",\"payload\": \"{{{payload}}}\"}{{#unless @last}},{{/unless}}{{/each}}]",
"authorTimestamp": "{{../data.authorTimestamp}}",
"authorId": "{{../data.authorId}}",
"authorFirstName": "{{../data.authorFirstName}}",
"authorLastName": "{{../data.authorLastName}}",
"created": "{{../data.created}}"
}{{#unless @last}},{{/unless}}
{{/each}}
]
14 changes: 14 additions & 0 deletions DSL/DMapper/hbs/filter-company-related-persons.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{{#each data.botMessages}}
{
"chatId": "{{../data.chatId}}",
"content": "{{formatDataByRole ../data}}",
"buttons": "[{{#each buttons}}{\"title\": \"{{{title}}}\",\"payload\": \"{{{payload}}}\"}{{#unless @last}},{{/unless}}{{/each}}]",
"authorTimestamp": "{{../data.authorTimestamp}}",
"authorId": "{{../data.authorId}}",
"authorFirstName": "{{../data.authorFirstName}}",
"authorLastName": "{{../data.authorLastName}}",
"created": "{{../data.created}}"
}{{#unless @last}},{{/unless}}
{{/each}}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{{#each data.botMessages}}
{
"chatId": "{{../data.chatId}}",
"content": "{{formatDataByContactType ../data}}",
"buttons": "[{{#each buttons}}{\"title\": \"{{{title}}}\",\"payload\": \"{{{payload}}}\"}{{#unless @last}},{{/unless}}{{/each}}]",
"authorTimestamp": "{{../data.authorTimestamp}}",
"authorId": "{{../data.authorId}}",
"authorFirstName": "{{../data.authorFirstName}}",
"authorLastName": "{{../data.authorLastName}}",
"created": "{{../data.created}}"
}{{#unless @last}},{{/unless}}
{{/each}}
]
53 changes: 53 additions & 0 deletions DSL/DMapper/hbs/public-initatives/get_five_most_recent.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!--
### Input example:
{
"response": [
{
"uuid": "ec1731df-6d0a-4b55-a549-6a407d3d2ab0",
"votingNumber": 13457,
"type": {
"code": "AVALIK",
"value": "Avalik"
},
"description": "Lõpphääletus",
"startDateTime": "2024-10-23T22:14:30.897",
"endDateTime": "2024-10-23T22:14:50.887",
"present": 88,
"absent": 13,
"inFavor": 47,
"against": 12,
"neutral": 1,
"abstained": 41,
"relatedDraft": {
"uuid": "6f956dbc-4c15-411c-95bc-3488327522d1",
"title": "Rahvusvahelise Tööorganisatsiooni (ILO) töömaailmas esineva vägivalla ja ahistamise kõrvaldamist käsitleva konventsiooni (nr 190) ratifitseerimise seadus",
"mark": 469,
"copyOrOriginal": "ORIGINAL",
"_links": {
"self": {
"href": "https://api.riigikogu.ee/api/volumes/drafts/6f956dbc-4c15-411c-95bc-3488327522d1"
}
}
},
"_links": {
"self": {
"href": "https://api.riigikogu.ee/api/votings/ec1731df-6d0a-4b55-a549-6a407d3d2ab0"
}
}
},
...
]
}
### Output example:
{
"result": "\"Rahvusvahelise Tööorganisatsiooni (ILO) töömaailmas esineva vägivalla ja ahistamise kõrvaldamist käsitleva konventsiooni (nr 190) ratifitseerimise seadus\"\nOsalejaid: 88 kohal, 13 puudus.\nTulemus: 47 poolt, 12 vastu, 1 neutraalne, 41 erapooletu.\n\n
...
"
}
-->
{
"result": "5 viimast rahvaalgatust:\n{{#each response as |vote|}}\"{{vote.relatedDraft.title}}\"\nOsalejaid: {{vote.present}} kohal, {{vote.absent}} puudus.\nTulemus: {{vote.inFavor}} poolt, {{vote.against}} vastu, {{vote.neutral}} neutraalne, {{vote.abstained}} erapooletu.\n\n{{/each}}"
}

34 changes: 34 additions & 0 deletions DSL/DMapper/hbs/public-initatives/get_most_popular.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!--
### Input example:
{
"response": [
{
"id": "ef15cad4-db50-47b2-a69e-59cc961d6fa0",
"for": "tallinn",
"title": "Nõuame bussiliini nr. 49 säilimist Viimsi-Pirita-Iru-Lasnamäe-Ülemiste",
"phase": "sign",
"signingEndsAt": "2024-10-31T22:00:00.000Z",
"signatureCount": 2904,
"signatureThreshold": 3518
},
{
"id": "b2247a84-34e5-4ef1-9976-675ed0335ce0",
"for": "tallinn",
"title": "Nõuame Lasnamäe jaoks hädavajaliku bussiliini nr 65 säilitamist!",
"phase": "sign",
"signingEndsAt": "2024-11-04T22:00:00.000Z",
"signatureCount": 2664,
"signatureThreshold": 3518
},
...
]
}
### Output example:
{
"result": "5 populaarsemat rahvaalgatust:\n\"Nõuame bussiliini nr. 49 säilimist Viimsi-Pirita-Iru-Lasnamäe-Ülemiste\"\nKogutud allkirjade arv on 2904 / 3518\n\n\"Nõuame Lasnamäe jaoks hädavajaliku bussiliini nr 65 säilitamist!\"\nKogutud allkirjade arv on 2664 / 3518\n\n\"Pöördumine Tallinna volikogule Pärtel-Peeter Pere tagandamiseks\"\nKogutud allkirjade arv on 1963 / 3518\n\n\"Lapsi toetav nutiseadmekasutuse reguleerimine Eesti koolidesse!\"\nKogutud allkirjade arv on 1856 / 1000\n\n\"Eesti toetab Palestiina omariiklust\"\nKogutud allkirjade arv on 1045 / 1000\n\n"
}
-->
{
"result": "5 populaarsemat rahvaalgatust:\n{{#each response}}\"{{title}}\"\nKogutud allkirjade arv on {{signatureCount}} / {{signatureThreshold}}\n\n{{/each}}"
}
26 changes: 26 additions & 0 deletions DSL/DMapper/js/electricity-helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Helper function to handle date conversion and timezone adjustment
function convertToEEST(timestamp) {
const date = new Date(timestamp * 1000); // Convert to milliseconds
date.setHours(date.getHours() + 3); // Adjust for EEST (UTC+3)
return date;
}

Handlebars.registerHelper('startDate', function(response) {
const firstEntry = response[0];
return convertToEEST(firstEntry.timestamp).toISOString().slice(0, 10); // Format YYYY-MM-DD
});

Handlebars.registerHelper('endDate', function(response) {
const lastEntry = response[response.length - 1];
return convertToEEST(lastEntry.timestamp).toISOString().slice(0, 10); // Format YYYY-MM-DD
});

Handlebars.registerHelper('formatTimestamp', function(timestamp) {
return convertToEEST(timestamp).toISOString().slice(0, 16).replace('T', ' '); // Format "YYYY-MM-DD HH:mm"
});

Handlebars.registerHelper('addVAT', function(price) {
const VAT = 1.22;
const total = price * VAT;
return Math.round(total * 100) / 100; // Round to 2 decimal places
});
13 changes: 0 additions & 13 deletions DSL/Ruuter.private/DSL/POST/reload.yml

This file was deleted.

Loading

0 comments on commit 2dc8e20

Please sign in to comment.