Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ECLK/results-tabulation i…
Browse files Browse the repository at this point in the history
…nto ECLKgh-879
  • Loading branch information
sm1990 committed Apr 5, 2021
2 parents 1c14a28 + ae2fc6b commit 70dddbe
Show file tree
Hide file tree
Showing 16 changed files with 14,326 additions and 266 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Platformer Generated dbu-dev-master-push Build
on:
push:
branches:
- master
jobs:
build:
runs-on:
- ubuntu-latest
env:
SERVICE_NAME: ghcr.io/eclk/results-tabulation
CONTAINER_REGISTRY: ghcr.io
steps:
- uses: actions/checkout@v2
- name: Set Version
id: event-version
run: echo ::set-output
name=SOURCE_TAG::${GITHUB_REF#refs/heads/}-${{github.sha}}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ${{ env.CONTAINER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build the Docker image
run: docker build --tag
${SERVICE_NAME}:update-${{steps.event-version.outputs.SOURCE_TAG }} --file
./results-tabulation-dashboard/Dockerfile
./results-tabulation-dashboard/
- name: GitHub Image Push
run: docker push $SERVICE_NAME:update-${{steps.event-version.outputs.SOURCE_TAG }}
- name: Platformer Deploy
uses: platformer-com/build-deploy-action@v1
with:
org-id: ${{secrets.ORG_ID_9CBA253F_B6ED_4CD0_B890_70A3810F0633}}
project-id: ${{secrets.PROJECT_ID_9CBA253F_B6ED_4CD0_B890_70A3810F0633}}
token: ${{secrets.AUTOGENERATED_CICD_9CBA253F_B6ED_4CD0_B890_70A3810F0633}}
image-name: ${{env.SERVICE_NAME}}
tag: update-${{steps.event-version.outputs.SOURCE_TAG }}
container-id: b852a116-f1eb-4800-80fb-47ba926442eb
2 changes: 1 addition & 1 deletion results-tabulation-api/constants/AUTH_CONSTANTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ADMINISTRATIVE_DISTRICT_REPORT_VIEWER_ROLE = "adm_dis_rep_view"
ADMINISTRATIVE_DISTRICT_REPORT_VERIFIER_ROLE = "adm_dis_rep_verf"
PROVINCIAL_REPORT_VIEWER_ROLE = "prov_rep_view"
PROVINCIAL_REPORT_VERIFIER_ROLE = "prov_dis_rep_verf"
PROVINCIAL_REPORT_VERIFIER_ROLE = "prov_rep_verf"
NATIONAL_REPORT_VIEWER_ROLE = "nat_dis_rep_view"
NATIONAL_REPORT_VERIFIER_ROLE = "nat_dis_rep_verf"
EC_LEADERSHIP_ROLE = "ec_leadership"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ def get_post_save_request_content(self):
election = self.tallySheetVersion.tallySheet.election
tally_sheet_id = self.tallySheetVersion.tallySheetId

minimum_vote_count_percentage_required = election.meta.get_meta_data(
metaDataKey=META_DATA_KEY_ELECTION_NUMBER_OF_VALID_VOTE_PERCENTAGE_REQUIRED_FOR_SEAT_ALLOCATION)
minimum_vote_count_percentage_required = 0.00
if minimum_vote_count_percentage_required is not None:
minimum_vote_count_percentage_required = float(minimum_vote_count_percentage_required)
minimum_vote_count_percentage_required = float(0.00)

number_of_members_to_be_elected = election.meta.get_meta_data(
metaDataKey=META_DATA_KEY_ELECTION_NUMBER_OF_SEATS_ALLOCATED)
Expand Down Expand Up @@ -166,15 +165,15 @@ def populate_seats_per_party(self, minimum_vote_count_percentage_required, numbe
# df.at[index, 'bonusSeatsAllocated'] = 0

valid_vote_count_required_per_seat = total_valid_vote_count_of_qualified_parties / number_of_members_to_be_elected
valid_vote_count_required_per_seat_ceil = math.ceil(valid_vote_count_required_per_seat)
valid_vote_count_required_per_seat_floor = math.floor(valid_vote_count_required_per_seat)

for index in df.index:
num_value = df.at[index, 'numValue']
if df.at[index, 'qualifiedForSeatsAllocation']:
number_of_seats_qualified = math.floor(num_value / valid_vote_count_required_per_seat_ceil)
number_of_seats_qualified = math.floor(num_value / valid_vote_count_required_per_seat_floor)
df.at[index, 'seatsAllocatedFromRound1'] = number_of_seats_qualified
number_of_members_to_be_elected -= number_of_seats_qualified
df.at[index, 'validVotesRemainFromRound1'] = num_value % valid_vote_count_required_per_seat_ceil
df.at[index, 'validVotesRemainFromRound1'] = num_value % valid_vote_count_required_per_seat_floor
else:
df.at[index, 'seatsAllocatedFromRound1'] = 0
df.at[index, 'validVotesRemainFromRound1'] = 0
Expand All @@ -197,7 +196,7 @@ def populate_seats_per_party(self, minimum_vote_count_percentage_required, numbe
df = df.sort_values(by=['numValue'], ascending=False)

df["voteCountCeilPerSeat"] = pd.Series(
np.full(len(df.index), valid_vote_count_required_per_seat_ceil),
np.full(len(df.index), valid_vote_count_required_per_seat_floor),
index=df.index)
df["minimumVoteCountRequiredForSeatAllocation"] = pd.Series(
np.full(len(df.index), _minimum_valid_vote_count_required_per_party_to_be_qualified),
Expand Down Expand Up @@ -246,8 +245,7 @@ def html(self, title="", total_registered_voters=None):
election = self.tallySheetVersion.tallySheet.election
tally_sheet_id = self.tallySheetVersion.tallySheetId

minimum_vote_count_percentage_required = float(election.meta.get_meta_data(
metaDataKey=META_DATA_KEY_ELECTION_NUMBER_OF_VALID_VOTE_PERCENTAGE_REQUIRED_FOR_SEAT_ALLOCATION))
minimum_vote_count_percentage_required = float(0.00)

minimum_valid_vote_count_required_per_party_to_be_qualified = total_valid_vote_count * minimum_vote_count_percentage_required

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ def _get_district_centre_entry(row):
)
administrative_district_election.meta.add_meta_data(
metaDataKey=META_DATA_KEY_ELECTION_NUMBER_OF_VALID_VOTE_PERCENTAGE_REQUIRED_FOR_SEAT_ALLOCATION,
metaDataValue=0.05
metaDataValue=0.00
)

# extract_csv_files()
Expand Down
2 changes: 1 addition & 1 deletion results-tabulation-api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ chardet==3.0.4
Click==7.0
clickclick==1.2.2
connexion==2.2.0
cryptography==3.2
cryptography==3.3.2
decorator==4.4.0
docopt==0.6.2
ecdsa==0.15
Expand Down
Loading

0 comments on commit 70dddbe

Please sign in to comment.