StudyRoom Feature #49
StudyRoom Feature #49
Conversation
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.
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> |
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 ;) |
@mammuth How are there groups and rooms. In the same array? Or are the rooms in the groups? |
There are two arrays. A RoomGroup has an array of roomNumbers.
Currently the manager is calling the handler twice (once with groups as
argument and once with rooms), which doesn't feel clean but the only other
way I could thought of was to don't use the given protocols (Data manager
and receiver protocols), since they force the handler in the manager to
take a [DataElement].
Sure, feel free to improve the UI!
Mathias Quintero <notifications@github.com> schrieb am Mo., 19. Dez. 2016,
03:35:
… @mammuth <https://github.com/mammuth> How are there groups and rooms. In
the same array? Or are the rooms in the groups?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#49 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AC-gmsW1emHZwp40fWLitqDCHTsaQLmLks5rJe1jgaJpZM4LQJSC>
.
|
Resolves #24 |
So this is not merged yet because the design needs some overhauls.
@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
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
@mammuth I'd go for the second design for sure! Looks very nice! |
@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. |
fastlane/Deliverfile
Outdated
###################### 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
since it is personal and doesn’t contain any meaningful settings (yet)
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 👍 |
@mammuth Is it ready? If not give me a heads up when it is. So far everything in the code looks fine |
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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 } |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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
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. |
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
Big ToDo's:
@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?