Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 3c28a76

Browse files
committed
Adds current_time_dilation & CD pipeline
1 parent 5059eeb commit 3c28a76

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

.github/workflows/CD.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CD
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
- name: Publish Docker
14+
uses: elgohr/[email protected]
15+
with:
16+
name: yogstation13/yogstation-feedback-normalisation/yogstation-feedback-normalisation
17+
username: ${{secrets.DOCKER_PUSH_USERNAME}}
18+
password: ${{secrets.DOCKER_PUSH_PASSWORD}}
19+
registry: docker.pkg.github.com
20+
tags: ${{github.sha}}
21+
- name: Deploy
22+
uses: steebchen/[email protected]
23+
env:
24+
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
25+
with:
26+
args: set image --namespace feedback-normalization cronjob/feedback-normalization feedback-normalization=docker.pkg.github.com/yogstation13/yogstation-feedback-normalisation/yogstation-feedback-normalisation:${{github.sha}}

src/main.rs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,31 @@ pub fn process_nested_tally(event: &FeedbackEvent) -> Vec<FeedbackEventNormalise
157157
}
158158

159159
pub fn process_associative(event: &FeedbackEvent) -> Vec<FeedbackEventNormalised> {
160-
println!("Received associative value, ignoring. Associative events will need a more manual approach. {:?}", event.key_name);
161-
vec![]
160+
let mut normalised_events = vec![];
161+
162+
match event.key_name.as_str() {
163+
"time_dilation_current" =>
164+
for (key, value) in event.json["data"].as_object().unwrap() {
165+
for (time_dilation_current, time_dilation_values) in value.as_object().unwrap() {
166+
let time_dilation_current = NaiveDateTime::parse_from_str(time_dilation_current, "%Y-%m-%d %H:%M:%S").unwrap();
167+
168+
for (time_dilation_average, time_dilation_value) in time_dilation_values.as_object().unwrap() {
169+
normalised_events.push(FeedbackEventNormalised {
170+
datetime: time_dilation_current,
171+
round_id: event.round_id,
172+
category_primary: event.key_name.clone(),
173+
category_secondary: time_dilation_average.to_string(),
174+
category_tertiary: "".to_string(),
175+
version: event.version,
176+
value: time_dilation_value.to_string(),
177+
});
178+
}
179+
}
180+
},
181+
_ => println!("Received associative value, ignoring. Associative events will need a more manual approach. {:?}", event.key_name)
182+
}
183+
184+
normalised_events
162185
}
163186

164187
pub fn process_text(event: &FeedbackEvent) -> Vec<FeedbackEventNormalised> {

0 commit comments

Comments
 (0)