Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

StudyRoom Feature #49

Merged
merged 21 commits into from Apr 16, 2017
Merged

StudyRoom Feature #49

merged 21 commits into from Apr 16, 2017

Conversation

mammuth
Copy link
Member

@mammuth mammuth commented Dec 18, 2016

I implemented the basic functionality of the Study Rooms Feature. It's linked in the More-View, fetches the rooms, and displays them in a sorted manner

bildschirmfoto 2016-12-18 um 20 48 02

Big ToDo's:

  • Decide on how to handle groups (sections vs. Picker as for movies vs. ?) (Right now there are only 3 groups: "Bibliothek Mathe/Informatik", "Magistrale Mathe/Informatik", "Garching-Hochbrück (EG)"
  • Link to Room Maps on click (of the whole row?)
  • Pull To Refresh (?)
  • Make layout "better" (I just moved the labels around to have "something", let's add some constraints)
  • Hate me for my color choices (Optional)

@mathiasquintero it'd be great if you could check this out and tell me whether I heavily ignored the wished patterns and concepts 😊 Also I'm pretty sure there is room for small improvements at many places.

The API request returns a JSON with rooms and groups in it. I'm not quite sure how to handle this, currently our TumDataReceiver is made to receive [DataElement]. Same for the Handlers. Any views on that?

@mammuth mammuth self-assigned this Dec 18, 2016
I therefore extended The RoomFinder VC to handle StudyRooms as well.
As a possible downside the fetched rooms are not cached, when leaving and reentering the study rooms view. However this probably makes sense and should have been this way anyway.
@kordianbruck
Copy link
Member

kordianbruck commented Dec 18, 2016

Please make sure, that any field might be empty at any time, so check for null/empty values.

Heres a Angular2 Codesnippet showing the current configuration for the website:

<div [ngClass]="{free:e.status == 'frei', full:e.status == 'belegt', unkown:e.status == 'unbekannt'}">
    <h4>
        {{e.raum_name}}
        <span *ngIf="e.status == 'belegt'">noch {{e.belegung_bis | amTimeAgo:true}}</span>
    </h4>
    <a href="https://campus.tum.de/tumonline/ris.einzelraum?raumkey={{e.raum_nr}}">{{e.raum_code}}</a>
    <span *ngIf="e.status == 'belegt'">
        | {{e.belegung_durch}}<br/>
        <a href="https://campus.tum.de/tumonline/wbKalender.wbRessource?pResNr={{e.res_nr}}{{calenderDisplayMode}}">
            Belegt <span *ngIf="e.belegung_ab">von {{e.belegung_ab | amCalendar }}</span> bis {{e.belegung_bis | amCalendar}}
        </a>
    </span>
</div>

@nerdsupremacist
Copy link
Member

Looks great. I would want to work on the UI a bit more. All green and red cells don't really go with the current design motive. Perhaps move it to the a small indicator view and the font color. If it's cool with you I'll do it ;)

@nerdsupremacist
Copy link
Member

@mammuth How are there groups and rooms. In the same array? Or are the rooms in the groups?

@mammuth
Copy link
Member Author

mammuth commented Dec 19, 2016 via email

@mammuth mammuth assigned nerdsupremacist and unassigned mammuth Dec 19, 2016
@kordianbruck kordianbruck mentioned this pull request Dec 19, 2016
@mammuth
Copy link
Member Author

mammuth commented Mar 3, 2017

Resolves #24

@mammuth mammuth mentioned this pull request Mar 31, 2017
@mammuth
Copy link
Member Author

mammuth commented Mar 31, 2017

So this is not merged yet because the design needs some overhauls.

Looks great. I would want to work on the UI a bit more. All green and red cells don't really go with the current design motive. Perhaps move it to the a small indicator view and the font color. If it's cool with you I'll do it ;)

@mathiasquintero are you on this? Otherwise I can try to implement your suggestion with transforming the visual indicator to the headline.

# Conflicts:
#	TUM Campus App.xcodeproj/project.pbxproj
#	TUM Campus App/More.storyboard
#	TUM Campus App/TumDataItems.swift
@mammuth
Copy link
Member Author

mammuth commented Apr 2, 2017

Something like this?

screen shot 2017-04-02 at 08 41 55

The "FMI/ Bibliothek" is actually redundant, isn't it? Those three "locations" are stated in the title bar and can be changed there, so there is actually no need to repeat it in every row.

screen shot 2017-04-02 at 08 49 24

@mammuth
Copy link
Member Author

mammuth commented Apr 2, 2017

I needed to do some merging with the More storyboard and the project file, hope I didn't break anything.

Ready to review @mathiasquintero . Also I didn't add any constraints yet.

Don’t know why, but the run configurations have not been properly set for the testing targets
@kordianbruck
Copy link
Member

@mammuth I'd go for the second design for sure! Looks very nice!

@nerdsupremacist
Copy link
Member

nerdsupremacist commented Apr 15, 2017

@mammuth please check that I didn't break anything during my merge. All the stuff that could go horribly wrong was in the pods xcodeproj so if it's broken do a pod install and it should be fixed :D

I'm not a machine I can't keep track of so many id's.
Did I mention that I hate xcodeproj files? Because I do

###################### Automatically generated ######################
# Feel free to remove the following line if you use fastlane (which you should)

app_identifier "de.tum.campusapp" # The bundle identifier of your app
Copy link
Member

Choose a reason for hiding this comment

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

What's this?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's the configuration file for fastlane deliver. "de.tum.campusapp" is the bundle id we use at the published app if I'm right.

However, this file probably shouldn't be tracked in git, since it's personalized.

I think you have also the permission to add builds to iTunes Connect, right? Then you can initiate deliver by running "fastlane deliver" in the project root once.

We can keep track of the changelog, screenshots, store description etc. in the repo in the metadata (I think?) directory. We can then use fastlane deliver to publish those metadata to iTunes Connect or even submit new builds for review.

See https://github.com/fastlane/fastlane/tree/master/deliver for usage details.

Copy link
Member

Choose a reason for hiding this comment

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

Damn Fastlane is really fancy!

static let StudyRoomFreeColor = UIColor(red: 0, green: 170/255, blue: 0/255, alpha: 1)
Copy link
Member

Choose a reason for hiding this comment

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

please use lowerCamelCase

if let data = response.result.value {
if let json = JSON(data).dictionary {
if let rooms = json["raeume"]?.array {
StudyRoomsManager.studyRooms.removeAll()
Copy link
Member

Choose a reason for hiding this comment

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

If we're already removeing everything and setting it again just write:

StudyRoomsManager.studyRooms = rooms.flatMap(StudyRoom.init)

Copy link
Member Author

Choose a reason for hiding this comment

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

Are my recent changes as you expected them to be?

Copy link
Member

Choose a reason for hiding this comment

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

Well then the loops are unnecesary. The flatMap does all the work for you

Copy link
Member

Choose a reason for hiding this comment

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

And you should set the Groups inside the other if. Not here, right?

@mammuth
Copy link
Member Author

mammuth commented Apr 16, 2017

Did I mention that I hate xcodeproj files? Because I do

I'm completely new to iOS, but this is probably the most insane thing I saw while learning it. I just don't get it why developers want to make settings in a fancy GUI which then get stored in an not-easy-to-understand binary-like insanely bloated settings file, which Xcode seems to even manipulate and change from time to time out of fun, even without the developer performing any change on purpose.

Did the requested changes, thanks for the review 👍

@nerdsupremacist
Copy link
Member

@mammuth Is it ready? If not give me a heads up when it is. So far everything in the code looks fine

Copy link
Member

@nerdsupremacist nerdsupremacist left a comment

Choose a reason for hiding this comment

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

I have some style suggestions. But I don't mind. Merge whenever you're ready ;)

extension StudyRoomsTableViewController: TumDataReceiver {

func receiveData(_ data: [DataElement]) { // Is called twice, once with [StudyRoomGroups] as argument, once for [StudyRooms]
for item in data {
Copy link
Member

Choose a reason for hiding this comment

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

Since we're already hunting down uncessesary loops:

roomGroups.append(contentsOf: data.flatMap { $0 as? StudyRoomGroup })
studyRooms.append(contentsOf: data.flatMap { $0 as? StudyRoom })

should do it ;)

didSet {
title = currentGroup?.name
currentRooms = self.studyRooms
.filter() { (self.currentGroup?.roomNumbers.contains($0.roomNumber)) ?? false }
Copy link
Member

Choose a reason for hiding this comment

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

you don't need the () when the only argument is a trailing closure.

if let data = response.result.value {
if let json = JSON(data).dictionary {
if let rooms = json["raeume"]?.array {
StudyRoomsManager.studyRooms.removeAll()
Copy link
Member

Choose a reason for hiding this comment

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

Well then the loops are unnecesary. The flatMap does all the work for you

@mammuth mammuth removed the not-ready label Apr 16, 2017
@mammuth
Copy link
Member Author

mammuth commented Apr 16, 2017

I have some style suggestions. But I don't mind. Merge whenever you're ready ;)

I give you all the power and responsibility 😆

Merge it, or add your style suggestions. Maybe just take a look that we get it into master before 20.4. so we can ship it with the next release.

@nerdsupremacist nerdsupremacist changed the title [WIP] StudyRoom Feature StudyRoom Feature Apr 16, 2017
@nerdsupremacist nerdsupremacist merged commit db94c38 into TUM-Dev:master Apr 16, 2017
@mammuth mammuth deleted the feature/24-study-rooms branch April 17, 2017 08:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants