Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Conversation

30mar
Copy link
Contributor

@30mar 30mar commented Jun 24, 2021

Description

Add Flow and Logic to Adding new local statistics
Add filtering mechanism
The remaining TO DOs are just a guidance on where to integrate the network calls and the persistence

Obstacles to work on:
1- moving the content Offset of the scrollView without animation.
2- the back button on the district navigation toolbar

Link to Jira

https://jira-ibs.wbs.net.sap/browse/EXPOSUREAPP-7687

Screenshots

RPReplay_Final1624543706.MP4

@30mar 30mar requested review from a team June 24, 2021 14:17
Copy link
Contributor

@NataliaLemmerth NataliaLemmerth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UA approved

@30mar 30mar added the task part of a feature label Jun 24, 2021
@30mar 30mar added this to the v2.6.0 milestone Jun 24, 2021
30mar added 2 commits June 24, 2021 17:03
…branch' into feature/7087-Statistic-data-local-7-day-incidence/7687-UI-7-day-local-incedences
})
}

// mutating func save() {
Copy link
Contributor

@naveeddotio naveeddotio Jun 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future: could be renamed to what is being save, save is a bit generic.

@@ -1367,7 +1367,11 @@ enum AppStrings {

enum Statistics {
static let error = NSLocalizedString("Statistics_LoadingError", comment: "")

enum AddCard {
static let SevenDayIncidence = NSLocalizedString("Statistics_Add_SevenDayIncidence", comment: "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sevenDayIncidence


enum CreatedLocalStatisticsState {
case empty // 0
case NotYetFull // 0 < number of local statistics cards < 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notYetFull

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would ditch the whole state which can lead to complications if not updated correctly and create a computed var:

var canAddMore: Boo { return currentCount < threshold }

States are bad!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whiskey we have 3 have three states o:
1- show only add button if there number of cards = 0
2- show both add and edit buttons when 0 < number < 5
3- disable add button but leave the edit button enabled when 5 < number

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know the use case but don't think it's the best solution here because if I miss out to update the state after removing a cell, it might get corrupted. Let's leave it for now but I'd like to test out my 'computed approach' as well and see if this is easy to implement w/o any dependencies to the store.


init(
localStatisticsModel: AddLocalStatisticsModel,
presentSelectStateList: @escaping (SelectValueViewModel) -> Void,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be presentFederalStatesList?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between a State and federalState ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A state can be a state in the app, so not to confuse the new developer, also it's "plural" States as is a list of FederalStates

init(
localStatisticsModel: AddLocalStatisticsModel,
presentSelectStateList: @escaping (SelectValueViewModel) -> Void,
presentSelectDistrictList: @escaping (SelectValueViewModel) -> Void
Copy link
Contributor

@naveeddotio naveeddotio Jun 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be presentSelectDistrictsList?

Copy link
Contributor

@whiskey whiskey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor questions and tweaks. Happy to discuss my points.

let jsonData = try Data(contentsOf: jsonFileURL)
self.allDistricts = try JSONDecoder().decode([DistrictElement].self, from: jsonData)
} catch {
Log.debug("Failed to read / parse district json", log: .ppac)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why no error then? It's more serious than just a debug log

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, need to discuss this with max

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I just mean logging the error as Log.error instead of .debug. Decoder errors are definitely worth noting!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Log.debug("Failed to read / parse district json", log: .ppac)
Log.error("Failed to read / parse district json: \(error)", log: .ppac, error: error)

error should not contain any critical information and can be dumped in the logs


enum AddCard {
static let SevenDayIncidence = NSLocalizedString("Statistics_Add_SevenDayIncidence", comment: "")
static let fromTheWholeCountry = NSLocalizedString("Statistics_Add_fromTheWholeCountry", comment: "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering, what is the difference between "whole country" and "nationwide"? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are actually different texts in German in the Design
the first is translated in german as "Gesamtes Bundesland" , the other is "Bundesweit"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aaahh. I would think suggest something like 'whole state' then because 'country' is more the whole of Germany than just a… state/Bundesland.

@naveeddotio naveeddotio changed the title Feature/7087 statistic data local 7 day incidence/7687 UI 7 day local incedences Feature/7087 statistic data local 7 day incidence/7687 UI 7 day local incidences Jun 25, 2021
30mar and others added 5 commits June 25, 2021 09:33
…ctValueTableViewController.swift

Co-authored-by: Carsten Knoblich <carsten@staticline.de>
…sticsCardView/AddStatisticsCardView.swift

Co-authored-by: Carsten Knoblich <carsten@staticline.de>
…UI-7-day-local-incedences' of github.com:corona-warn-app/cwa-app-ios into feature/7087-Statistic-data-local-7-day-incidence/7687-UI-7-day-local-incedences
@naveeddotio naveeddotio self-requested a review June 25, 2021 09:24
@30mar 30mar merged commit 26be896 into feature/7087-Statistic-data-local-7-day-incidence/storybranch Jun 25, 2021
@30mar 30mar deleted the feature/7087-Statistic-data-local-7-day-incidence/7687-UI-7-day-local-incedences branch June 25, 2021 09:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
task part of a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants